2

I have a process builder that sends newly created leads to an account queue to be round robin'd by some apex code executed in a before trigger if the new lead meets certain criteria. I then am wanting an email alert to go out to the newly assigned lead owner after the round robin.

I am using workflow rules to send the email alert with the following formula:

And( 
Contains(Owner:User.UserRole.Name ,'MyRole'), 
DATEVALUE(CreatedDate) = Today(), 
LastModifiedById <> Owner:User.Id, 
ISBLANK(LastActivityDate) 
)

I have the evaluation criteria set to Evaluate the rule when a record is created, and every time it's edited. However, from what I can see in the debug logs, this workflow rule is only ran before the lead gets sent through the Round Robin process, so the owner ID in this case is the database, which causes the criteria to evaluate to false. I'm pretty stumped as to why this isn't evaluating when the lead owner changes after the round robin.

1

I believe something with the order of execution was causing this, so I ended up putting this logic in an Apex trigger that runs after update as workflows do not give me the control necessary to do this that I know of.

  • Hey Josh, I'm just now encountering the same exact instance in April 2019, and I can tell you that my formula is much less elaborate than yours. I think I've boiled it down to Owner:User.Id not showing the User Id, it always evals to null for me. Even though the debug log recognizes that my ISCHANGED(OwnerId) evals to a User Id, the Owner:User.Id val continues to throw null, so criteria always fails. My solution for now seems to be writing the logic in my trigger also. I think this is a bug to be honest, seems wrong. – Morgan Marchese Apr 2 at 1:25

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.