Since global variables can not be used in Filter criteria, I created a formula field, to pass it through. But referencing this formula (with global variable) in a Lookup Filter does not work

Custom Setting: CompetitionSettings__c

  • Number: WinnerThreshhold__c

Custom Object: Participant__c

  • Number: Rank__c
  • Formula: IsAWinner__c [Rank__c == $Setup.CompetitionSettings__c.WinnerThreshhold__c]

This works so far and is displayed in the layouts. But as soon, as I try to reference this field in a filter criteria on a lookup, saving the criteria fails:

Custom Object: Price__c

  • Lookup: AwardedTo__c

    Criteria: Participant__c.IsAWinner__c equals value TRUE

When I try to save this criteria, I get this Error message:

Error: Error in referenced formula IsAWinner__c, Field $Setup.CompetitionSettings__c.WinnerThreshhold__c does not exist. Check spelling.

But it exists and it works in other contexts

Everything I found online is this, where his statement at the end is:

It looks like the actual problem is any $ formula fields referenced in a lookup filter...

But there is no reference for this information.


Currently that's not possible. The salesforce documentation on Global Variables states that the $Setup variable is only available in Visualforce pages, formula fields, validation rules, flow formulas and process formulas.

Depending on what you want, there's a somewhat doable workaround here.

You can also vote on this idea.

| improve this answer | |
  • Thanks, this is a qualified answer. The workaround is not an option in my case, but at least I finally have the answer. Idea is upvoted. Thanks! – Basti Apr 20 '16 at 12:41
  • Quote from the workaround blog you just linked: "$setup fields aren’t available in the lookup filter selection and when they are referenced in formula fields the filter can’t be saved with an error stating that the $setup field cannot be found." – Basti Apr 20 '16 at 12:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.