You need to sign in to do that
Don't have an account?
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); }
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
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>);