You need to sign in to do that
Don't have an account?
Update trigger AND workflow rules
Good morning everyone!
So I encountered an issues and it seems that it would be very common, so I thought you guys might be able to help me out.
I created a trigger that runs on UPDATE, however, anytime a record is inserted the update trigger fires. I believe I know why it happens but I need to prevent it. I believe that when a record is inserted, workflow rules with field updates cause the record to be updated thus fireing the UPDATE trigger.
So my question is, what can I do to my trigger to prevent the workflow rule from making my UPDATE trigger fire on INSERT?
I give kudos and follow up on all posts so if you can help I will return the favor.
Thanks,
Ok so here is an update. I made a template that requires a workflow rule that will always fire on a case. I created two custom fields that are usd as toggle switches. The workflow rule will always update one of the fields to be true. The other field will be turned on/off depending on whether it is an insert or update. At the end of the trigger both fields are reset. I'm sure there are better ways of doing it but I am not going to debate that, this is a specific problem I had and a specific solution was necesary. The @future annotation didn't meet my needs. I am a newbie to programming on the force platform so please don't flame me lol. Here is the template I created:
All Answers
1. adds some filter condition in workflow rule.
2. creates a field in the object.
Thanks,
Samba
Ok so here is an update. I made a template that requires a workflow rule that will always fire on a case. I created two custom fields that are usd as toggle switches. The workflow rule will always update one of the fields to be true. The other field will be turned on/off depending on whether it is an insert or update. At the end of the trigger both fields are reset. I'm sure there are better ways of doing it but I am not going to debate that, this is a specific problem I had and a specific solution was necesary. The @future annotation didn't meet my needs. I am a newbie to programming on the force platform so please don't flame me lol. Here is the template I created: