0

i got a requirement to send an email to specific person in email field whenever any opportunity is created when an lead is converted.so i write a formula like

For reference: enter image description here

But if select 1.Created in criteria it is not working.

If i select 3.Criteria it is working

And Team Lead Mail field is updated based on a field in opportunity through process builder.

what i have to do if i want to this work in !.criteria

3
  • Am I correct in assuming that when you say 1.Created and 3.Criteria you're talking about the evaluation criteria Created and Created, and every time it's edited to subsequently meet criteria? Is the Opportunity record type set when you convert a lead, or is that taken care of in a trigger or workflow rule?
    – Derek F
    Jul 26, 2016 at 13:47
  • Ya you are right.But i don't have any record type for opportunity.I updated the email field called team lead mail based on opportunity owner @Derek F
    – Pavan tej
    Jul 26, 2016 at 14:01
  • Ah, I misread the rule criteria (I thought Opportunity's Type field label meant it was a recordtype, but that is not the case). Your comment does shine a light on what is going on. I'll write up an answer.
    – Derek F
    Jul 26, 2016 at 14:23

1 Answer 1

1

True to its name, the Created workflow evaluation setting only runs when a record is inserted. If your record doesn't meet the rule criteria by the time the workflow rule is evaluated, you've missed your chance.

If you are manually updating your target fields after they are inserted (or via workflow field update), then it should come as no surprise why a Workflow rule set to evaluate only when a record is created isn't being run (because that record has already been created, and you are now updating that previously created record.)

You can change fields in a Before Insert trigger on Opportunity to set your two fields to meet your workflow's rule criteria, and the workflow rule will still run.

I'm not so sure if it'll work if you have an After Insert Opportunity trigger that then calls a Before Update Opportunity trigger. Technically, it's in the same transaction as the insert, and would end up being run before workflow rules are evaluated. I'm afraid I don't have time to test if this works right now.

+edit:

According to comments, you are accomplishing this update (of team lead email) via Process Builder. I don't have much experience with processes, but I think I've read enough to help out here.

If you take a look at the Salesforce Order of Operations, Processes (built via Process Builder) run after triggers and after workflow rules.

That means that your update to the field occurs too late for a workflow rule, that only runs on record creation, to be able to use it. My understanding is that a process field update will cause triggers to fire again, but at that point it is no longer considered running on record creation, but rather on an update of the record (this explains why changing the evaluation criteria to Created, and every time it's edited to subsequently meet criteria works).

Your options to work around this are

  • stop using process builder, and do this field update in a Before Insert trigger
  • remove the workflow rule you currently have and make it part of your process. Create a flow to send your email alert, and execute your flow as an immediate action in your process
2
  • Hey thanks but i my scenario team lead mail field is updated based on opportunity owner based on process builder.@Derek F
    – Pavan tej
    Jul 26, 2016 at 15:26
  • @Pavantej That's some important information that should be included in your question.
    – Derek F
    Jul 26, 2016 at 15:46

You must log in to answer this question.

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