+ Start a Discussion
Vipin  PulinholyVipin Pulinholy 

Approval Process Trigger Error

Hi,

 

I get the following Compile Error on this code. Could any one please help me to fix this?

 

Error: Compile Error: Expression of type Approval.ProcessSubmitRequest has no member named setNextApproverIds at line 7 column 1
 

 

 

Code:

trigger submitForApproval on test1__c (after update) { // Create an approval request for the account Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest(); req1.setComments('Submitting request for approval.'); req1.setObjectId(trigger.old[0].id); //req1.setNextApproverIds(new Id[] {UserInfo.getUserId()}); req1.setNextApproverIds='00530000000oigU'; // Submit the approval request for the account Approval.ProcessResult result = Approval.process(req1); }

 

Message Edited by das on 04-15-2009 04:10 PM
Best Answer chosen by Admin (Salesforce Developers) 
werewolfwerewolf

Read the error:

 

Approval.ProcessSubmitRequest has no member named setNextApproverIds

 

Now see the docs for ProcessRequest, where setNextApproverIds is defined -- there is in fact no member on it called setNextApproverIds. It's a method, and you have to call it with an array of IDs.  So it would be more like req1.setNextApproverIds(<array of 1 or more IDs goes here>);

All Answers

werewolfwerewolf

Read the error:

 

Approval.ProcessSubmitRequest has no member named setNextApproverIds

 

Now see the docs for ProcessRequest, where setNextApproverIds is defined -- there is in fact no member on it called setNextApproverIds. It's a method, and you have to call it with an array of IDs.  So it would be more like req1.setNextApproverIds(<array of 1 or more IDs goes here>);

This was selected as the best answer
Vipin  PulinholyVipin Pulinholy
OK. Thanks for the reply....My mistake.