function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Squire Q KershnerSquire Q Kershner 

How would you make a Trigger fire from a Workflow rule?

We are looking to fire a trigger based on the record result of a workflow rule.  My initial thought would be to write an entirely new trigger that encorporates the logic of the workflow rule AND the existing trigger, but if we can just tell the existing trigger to fire after the workflow completes, it won't require developer time.

Thoughts?
Best Answer chosen by Squire Q Kershner
kevin Carotherskevin Carothers
Hi-

On your workflow, create a field update action.
Then, have the logic you want performed in an after update trigger.

The best practice for this type of logic is to have the trigger logic look only at the field that the workflow modified.  Then, if you need to turn off or suspend the action, you can just inactivate the workflow.   If you coded the trigger logic correctly, there shouldn't be any action.

 

All Answers

kevin Carotherskevin Carothers
Hi-

On your workflow, create a field update action.
Then, have the logic you want performed in an after update trigger.

The best practice for this type of logic is to have the trigger logic look only at the field that the workflow modified.  Then, if you need to turn off or suspend the action, you can just inactivate the workflow.   If you coded the trigger logic correctly, there shouldn't be any action.

 
This was selected as the best answer
cmoylecmoyle
My suggestion would be to have the workflow perform a field update on the records you want to process in the triggers. You can then write an after/before update trigger for the associated record's objects that process the records mondified in the workflow.
Squire Q KershnerSquire Q Kershner
So to clarify for myself, We wouldn't actually set up the workflow to run a specific trigger as one the actions.  We have the workflow do it's normal actions, and then have the trigger evaluate the record following the workflow rule field-update (After Update) , and if the criteria is true, then run the trigger.

The short version:  I'm over-thinking it.
Thank you!