You need to sign in to do that
Don't have an account?
Shruthi MN 88
Automate approval process on Quote
Can you help complete the below code along with trigger
public class ApprovalProcessHandler {
public static void approval(){
Approval.ProcessSubmitRequest req = new Approval.ProcessSubmitRequest();
req.setObjectId('0055j000009sbROAAY');
//If the next step in your approval process is another Apex approval process, you specify exactly one user ID as the next approver.
//If not, you cannot specify a user ID and this method must be null.
//req.setNextApproverIds(null);
Approval.ProcessResult processResult = Approval.process(req);
//Valid values are: Approved, Rejected, Removed or Pending.
System.assertequals('Draft', + processResult.getInstanceStatus());
}
}
3. Automate approval process on Quote ( created in previous tasks ) using trigger.
Check approval criteria in trigger.
public class ApprovalProcessHandler {
public static void approval(){
Approval.ProcessSubmitRequest req = new Approval.ProcessSubmitRequest();
req.setObjectId('0055j000009sbROAAY');
//If the next step in your approval process is another Apex approval process, you specify exactly one user ID as the next approver.
//If not, you cannot specify a user ID and this method must be null.
//req.setNextApproverIds(null);
Approval.ProcessResult processResult = Approval.process(req);
//Valid values are: Approved, Rejected, Removed or Pending.
System.assertequals('Draft', + processResult.getInstanceStatus());
}
}
Can you elaborate more on the ask?
Are you looking for trigger logic for the above handler class?
trigger ApprovalProcessHandlerTrigger on Quote ( after insert,after update) {
ApprovalProcessHandler.approval();
}
connect 4 (https://connect-4.io)
You can refer below trigger logic and make adjustments as per your requirement. Related:https://www.jitendrazaa.com/blog/salesforce/dynamic-approval-process-based-on-the-apex-and-trigger/
If this information helps, please mark the answer as best. Thank you