I have a flow that's throwing a "failed to find record" error, despite having checked the box to assign a NULL value to the variable if nothing is found. I've also assigned a FAULT route for the step.

The intention for this step is to check if there's an existing record, and if so, to send an email. If there isn't a record, it creates one. This is done via a decision step immediately after the record lookup.

It's worth noting that the flow actually works, it continues on despite the error being sent to me.

Here's the error message via email:

RECORD QUERY: Check_for_Existing_Campaign_Name Find one CampaignMember record where: Name__c Equals true LeadOrContactId Equals {!MemberId} (0031N00001Xf4IOQAZ) Result Failed to find record.

and here's the flow:

enter image description here

enter image description here

Any ideas where I'm going wrong?

  • you have a custom field called Name__c that is a checkbox (you are comparing it to true) -- seems like an odd field name to be a Boolean
    – cropredy
    Commented Jul 7, 2018 at 2:21
  • @cropredy it’s a checkbox. Is that not the correct way to evaluate it?
    – Matt
    Commented Jul 7, 2018 at 2:44
  • Matt - you’re fine. I thought you might have had the wrong field.
    – cropredy
    Commented Jul 7, 2018 at 3:46

1 Answer 1


I found the issue. I ran a debug log and tested it and saw this error:

11:30:12.54 (1227925369)|EXCEPTION_THROWN|[EXTERNAL]|System.QueryException: Non-selective query against large object type (more than 200000 rows). Consider an indexed filter or contact salesforce.com about custom indexing. Even if a field is indexed a filter might still not be selective when: 1. The filter value includes null (for instance binding with a list that contains null) 2. Data skew exists whereby the number of matching rows is very large (for instance, filtering for a particular foreign key value that occurs many times)

This leads me to the following help article: https://help.salesforce.com/articleView?id=000002493&type=1

I'll be trying these solutions to see if it helps.

  • Were you able to find a solution to this issue?
    – Garywoo
    Commented Nov 20, 2020 at 11:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .