我将此触发器写入自动提交批准请求:
trigger OpportunitySubmitForOrderListApproval on Opportunity (after update) {
for (Integer i = 0; i < Trigger.new.size(); i++) {
if ((Trigger.old[i].Integration_fees__c == 0 && Trigger.old[i].Integration_waived__c== True) && (Trigger.new[i].Integration_fees__c==0 && Trigger.new[i].Integration_waived__c== True)) {
// create the new approval request to submit
Approval.ProcessSubmitRequest req = new Approval.ProcessSubmitRequest();
req.setComments('Submitted for approval. Please approve.');
req.setObjectId(Trigger.new[i].Id);
// submit the approval request for processing
Approval.ProcessResult result = Approval.process(req);
// display if the reqeust was successful
System.debug('Submitted for approval successfully: '+result.isSuccess());
}
}
}
我还使用此条目创建批准程序:
(Opportunity: Integration fees EQUALS 0) AND (Opportunity: Integration waived EQUALS True).
他们发送给审批人的自动2批准请求。 也许我需要删除两个? 非常感谢你!