0

I have a picklist field-XYZ which contains a lot of values.Lets say (A,b,c,d...z) I am trying to write a rule criteria which will execute if the picklist value is any of the following (A,b,c...p).So instead of mentioning all the values in rule criteria , i created a custom label and put the values (a,b,c,d..p) in that and wrote the following in the rule criteria :

CONTAINS(TEXT(XYZ__c) ,$Label.CustomLabel))

This is not working even is the value of the picklist is equal to the one mentioned in the Custom Label.I guess the CONTAINS function is matching the whole value of custom label with Picklist.Is there other workaround/solution for this?

3 Answers 3

1

Yes, your CONTAINS function is matching the whole value of custom label. You may have to create separate labels for each picklist values. Hopefully the picklist values are not so many, otherwise you may end of creating lots of label.

The logic will be like this:

OR(
    CONTAINS(TEXT(XYZ__c) ,$Label.CustomLabelA),
    CONTAINS(TEXT(XYZ__c) ,$Label.CustomLabelB)
)
2
  • That's the issue @Santanu .I will have to create a lot of labels. That's what i am trying to avoid. Any other approach?
    – Samir
    Commented Feb 6, 2017 at 15:08
  • Only other approach is playing around with apex code Commented Feb 6, 2017 at 16:49
1

Labels don't get evaluated as part of workflow rule, you can refer https://help.salesforce.com/articleView?id=workflow_rules_define.htm&type=5

0

I know this is over 4 years old but wanted to share for anyone who might stumble across this as well...

Samir actually had it correct, it's just backward. No need to create more than one Custom Label. Check it out:

CONTAINS(TEXT(XYZ__c) ,$Label.CustomLabel)) 

...needs to be...

CONTAINS($Label.CustomLabel, TEXT(XYZ__c))

Explaination: The syntax of the CONTAINS function is CONTAINS(does this contain, this text?). So Samir's code was asking, "Does XYZ__c contain 'a,b,c,d...z'?" which is false. But a true statement, assuming XYZ__c is a single letter of the alphabet, is, "Does 'a,b,c,d...z' contain the letter in XYZ__c?"

I hope this helps :)

You must log in to answer this question.

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