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
RejonesRejones 

I need help with APEX Trigger for Approval process

I am trying to get an opportunity to auto submit for an approval process called Incentive offer when the field Incentive offer in the oppportunity is Yes.

 

I build the following but keep getting an error message error: expecting a right parentheses, found 'Offer' at line 5 column 30

 

 

trigger OpportunitySubmitForApproval on Opportunity (after update) {  

 

     for (Integer i = 0; i < Trigger.new.size(); i++) {         

 

  if (Trigger.Incentive Offer Yes) {              

 

 // create the new approval request to submit       

 Approval.ProcessSubmitRequest req = new Approval.ProcessSubmitRequest();      

 req.setComments('Submitted for approval. Please approve.');

 req.setObjectId(Trigger.new[i].Id);            

 // submit the approval request for processing            

Approval.ProcessResult result = Approval.process(req);            

 // display if the reqeust was successful            

 System.debug('Submitted for approval successfully: '+result.isSuccess());          

 

              }      

 

         }

 

 }

 

Steve :-/Steve :-/

You should probably post this on the Apex Board, this one is geared mostly towards basic Formula Code

RejonesRejones

Will do thank you