In a workflow rule I need to check for specific strings within a text field. A simple substring match using "contains" cannot work as it would lead to ambiguity, I put the strings inside of quotation marks. Now the criterion should match the substring including the quotation marks.

Specifically I need a criterion that matches the current user's role. So the role name would be "something 'exact string' some more". My rule should therefore be

Current user: Role  contains  'exact string'

If I enter into the field 'exact string' and save the criterion, it results in

Current user: Role  contains  exact string

basically turning back to the simple substring. If I enter ''exact string'' the resulting rule looks okay. It actually reads

Current user: Role  contains  'exact string'

but the criterion is never met. Within code you would of course use the backslash to escape the quotation marks, but that does not work in these rules either.

How can I have a workflow rule criterion match strings including quotation marks?

  • It would be help full for you salesforce.stackexchange.com/questions/165231/…
    – Pavan tej
    Commented Sep 13, 2017 at 13:51
  • Thanks, but not really. In this case the quotes are the first and the last character of the filter. But when saving, the quote marks are removed from the criterion. 2 consecutive quote marks result in single quote marks, yet the rule does not match. Commented Sep 13, 2017 at 14:00

1 Answer 1


You can use "formula evalutes to true" and then use this formula: CONTAINS($UserRole.Name, '"exact string"')


  • Thank you! I never thought to open that drop down, just tried to somehow get the criteria to match. Commented Sep 13, 2017 at 16:50

You must log in to answer this question.

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