Salesforce Fact #306 | Get latest lead Owner Id from flow

We can define assignment rules on Lead & Case objects. Now, suppose we have a use case where we have active assignment rule and we would like to access the latest Owner Id of the record in trigger/flow after the assignment rule is run while the record is created.

Now, as per the Order of Execution all the before and after triggers are run before the assignment rule. But after save record triggered flow could be helpful in this case to get the updated data since they are run after the assignment rule.

In this example, we have active assignment rule on Lead. To demonstrate the scenario, we are creating one Account each from the after insert Lead trigger and after insert Lead record trigger flow and storing the Lead Owner Id in the account description. The trigger is getting the Owner Id before the assignment rule is run, but the flow is able to get the Owner Id of the queue.

Attached are the screenshots.








Comments

Popular posts from this blog

Salesforce Fact #192 | Call batch apex from flow

Salesforce Fact #457 | Get current user role name in flow