I have a before update/insert trigger on Contact
trigger ContactTrigger on Contact (before insert, before update) {
for(contact con:Trigger.New){
If (con.FirstName ==con.LastName){
con.FirstName='Default';
con.Level__c = 'Primary';
}
}
}
Also, I have a process builder, on contact object that triggers on record update/insert
Condition : Level = Primary (not marking the advanced check for specific change to occur to invoke process builder)
Action:
- Change FirstName = LastName
- Add a case and assign it to this contact.
Now, I am adding a contact with First name ='test' and last Name = test'
The record gets saved as 'Default test' with one case created and assigned.
Thus order of execution : Trigger –> process builder –> Trigger
I was expecting this to get into recursion issue. But it is not. May I know the reason? I am just trying to understand the order of execution.
Best Answer
I believe the order of execution you're seeing runs like this:
You do have recursion, but Process Builder's configuration is preventing it from running away and causing a limit exception.