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
prasanth kumarprasanth kumar 

trigger with auto approval process error

before this rigger i created an approval process in account object with condition  "annual revenue <10000".     If i am giving amount less than 10000 annual revenue in new account record the trigger is firing and sending auto approval process. but if i enter more than 10000  ... eg:- entering 12000 in annual revenue then clicking on the save button in account object then it is throwing error,   Please help me.

User-added image
 
trigger accountApprovalSubmitAction on Account (after insert) {
for (Account a : trigger.new)
{
Approval.ProcessSubmitRequest appAction = new Approval.ProcessSubmitRequest();
appAction.setObjectId(a.id);
Approval.ProcessResult resultAction = Approval.process(appAction);
}
}

 
Amit Chaudhary 8Amit Chaudhary 8
Please check below post. I hope that will help you
http://www.jitendrazaa.com/blog/salesforce/dynamic-approval-process-based-on-the-apex-and-trigger/

Please mofidy your code according to above link sample