There seems to be an outstanding Find bug in best bets, when used with commerce, if the user sets up a best bet selecting a category as the commerce content (instead of a page or variant). This results in a cast error, and also prevents the Epi Find UI from loading correctly (so the invalid best bet can't be deleted through the Find UI).
Is there a fix for this available, and if not, do you have a script we can use to delete all best bets from the DB directly?
I ended up deletiing all the Best Bets from the DB, as it's just a dev environment so no great shakes to lose them all. This worked fine for me, but obviously hard deleting stuff out of the CMS DB comes with risk attached. Posting the script here is case it's useful to someone, but it's quite clearly unsafe so only intended for use on dev databases; back up DB before use, check the items it will be deleting before running it, cross fingers and hope for the best (bets)
DECLARE @ids table (id int IDENTITY, val int not null)
INSERT INTO @ids
SELECT pkId FROM tblBigTable
WHERE ItemType LIKE '%BestBet%'
DECLARE @number int
DECLARE @bestBetId int
DECLARE @count int
SELECT @count = COUNT(*) FROM @ids i
PRINT '' + CAST(@count AS nvarchar) + ' items to process'
WHILE @number <= @count BEGIN
PRINT 'Processing item ' +
CAST(@number AS nvarchar) + ' of ' +
CAST(@count AS nvarchar)
SELECT @bestBetId = val FROM @ids i WHERE i.id=@number
DELETE FROM tblBigTableReference WHERE pkId=@bestBetId
DELETE FROM tblBigTableReference WHERE RefIdValue=@bestBetId
DELETE FROM tblBigTable WHERE pkId=@bestBetId
DELETE FROM tblBigTableIdentity WHERE pkId=@bestBetId
SET @number = @number + 1
This bug is fixed in Find Commerce 9.6.1 and will be released next week