Target Record:
A Case record with Status =”New” in Database. There is trigger which updates the value of Status =”Working” in before update event. There is workflow too which updates to Status to “Escalated”. So, we are going to analyze how system behaves in these scenarios:
Lets play as below:
- Opened Case. It’s status = ‘New’.
- Changed the status manually to “Assigned”
- Before Update:
- Debug the old & new value
- Old value is => New
- New value is =>Assigned
- Update the status to Working
- Status = “Working”
- Debug the old & new value
- After Update:
- Debug the values
- Old value is still => New
- New value is =>Working
- Debug the values
- After that, workflow field update executes. And updates the status to “Escalated”
- Now, trigger executes again 🙂
- Before Update:
- Debug the old & new value
- Old value is still => New
- New value is =>Escalated
- Update the status to WorkingStatus = “Working”
- Debug the old & new value
- After Update:
- Debug the values – Old value is still => New
- New value is =>Working
P.S: In all events, old value remains same whatever it was in database.
Post credit: Paramvir Singh – https://www.linkedin.com/in/paramvir-singh-54906ba0