Assume a workflow where you do a field update based on some criteria match and on the same field if we set Trigger that creates a Task.
In my last post here - I have already discussed this issue, but I believe this is more well driven efficient approach than the previous one.
The very first solution comes in mind is using 'Static variable' to keep track of whether a task has already been created in this execution context, and simply exit when the variable is set. However, the solution fails in the cases when workflow itself doing field update that you want to track.
The better approach that I implemented was mixture of my experience and 'Dan Appleman' approach which deals with keeping track of 'correct old-value' the value that is set during the previous trigger invocation.
Code snippet below explains the approach
Find Dan Appleman here and his outstanding piece of work here What happens next if someone activate this workflow ?
You will get 'two' tasks on each opportunity and result in test failure
In my last post here - I have already discussed this issue, but I believe this is more well driven efficient approach than the previous one.
The very first solution comes in mind is using 'Static variable' to keep track of whether a task has already been created in this execution context, and simply exit when the variable is set. However, the solution fails in the cases when workflow itself doing field update that you want to track.
The better approach that I implemented was mixture of my experience and 'Dan Appleman' approach which deals with keeping track of 'correct old-value' the value that is set during the previous trigger invocation.
Code snippet below explains the approach
0 comments:
Post a Comment