0

I have two workflow email alerts when a case is created from an email (email-to-case).

Workflow rule 1:

CONTAINS("[email protected]", Source:EmailMessage.ToAddress)

Workflow rule 2:

CONTAINS("[email protected]", Source:EmailMessage.ToAddress)

Example: When a user sends an email to "[email protected]" , a case will be created with email where toAddress is "[email protected]". After that the Workflow rule 1 should fire to send a response. But currently both Workflow rules are firing

Example: When a user sends an email to "[email protected]" , a case will be created with email where toAddress is "[email protected]". After that the Workflow rule 2 should fire to send a response. But currently both Workflow rules are firing

Why both rules are firing?

Update: When I debug, the ToAddress Value comes as Null even though the email is there in the case.

1
  • check your debug log; most likely you have recursive updates on the Case. You should also consider switching to Flow as you get more control
    – cropredy
    Commented Jan 25, 2022 at 1:51

1 Answer 1

0

You have reversed the parameters in the CONTAINS() function, see documentation:

CONTAINS(text, compare_text) and replace (e.g. compare) text with the text that contains the value of compare_text.

So your formula should be

CONTAINS(Source:EmailMessage.ToAddress, "[email protected]")
3
  • I tried this way, in that case both are not firing
    – Arzad
    Commented Jan 25, 2022 at 9:27
  • How did you get Source:EmailMessage.ToAddress That is not a typical API name for a field. Commented Jan 26, 2022 at 1:08
  • this is a formula field reference for ToAddress from EmailMessage object. Anyway I found the issue. When workflow rule fires the email is getting created after some seconds, so when I tried to retrive the ToAddress when case created it comes as Null which satisfies both Rules. Fixed by switching to lightning to fire the triggered Flow by sceduling a delay
    – Arzad
    Commented Jan 29, 2022 at 7:59

You must log in to answer this question.

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