trigger Call_AprovalProcess_In_Trigger on Account (before insert, before update) {
for(Account acc:trigger.new){
if(acc.AnnualRevenue < 2000){
approval.ProcessSubmitRequest aprlPrcs = new Approval.ProcessSubmitRequest();
aprlPrcs .setComments('Submitting record for approval.');
aprlPrcs.setObjectId(acc.id);
aprlPrcs.setNextApproverIds(new Id[] {UserInfo.getUserId()});
approval.ProcessResult result = Approval.process(aprlPrcs);
}
}
}
No comments:
Post a Comment