3

We are using the trigger to kick off an approval process, the trigger fires when the opportunity is updated, can you please let me know how we can configure the entry criteria to "Is opportunity updated". Thanks for any help on this.

  • I agree with @crmprogdev a before/after trigger context may do what you need, but without more information its hard to provide a more accurate solution. – Ricky Hewitt Jun 24 '14 at 22:24
  • do you want the approval process to unconditionally start every time the Opportunity is updated? what about if it is already approved or in the middle of an approval process? – cropredy Aug 24 '14 at 3:47
1

There's a "Before Update" and an "After Update". Normally, one would set up something like what you're describing with the following syntax.

 // Before Update:
 if(trigger.isBefore == true && trigger.isUpdate == true){

    // do something here

 } // end Before Update code section


 // After Update:
 if(trigger.isAfter == true && trigger.isUpdate == true){

    // do something here

 } // end After Update code section 

I'm guessing from your description that you'd want to set up your trigger as an "AfterUpdate", but you've not provided enough information to really say. A BeforeUpdate trigger fires any time you're preparing to make an update to the record. This occurs before its been saved to the database and does not trigger workflow. An AfterUpdate trigger would cause your approval process code to execute every time an update to an existing record is saved to the database, regardless of whether any changes were made to your opportunity.

0

I'm not sure if you really need the trigger here. The platform already has these built in. You can create a criteria based workflow that will get kicked off and create the process for you:

http://www.salesforce.com/_app/video/workflow/help/create_workflow_rule.jsp

  • Agree with Brent, seem very little reason not to use Approval rules and possibly Process Builder to guide the entry into the process. – Michael Gill Mar 5 '15 at 8:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.