You need to sign in to do that
Don't have an account?
youji37
invoke Approval in trigger
I want to invoke a approval in trigger, I only know the approval name like 'Unit cost less than Field Min', but don't know how to invoke it in trigger.
trigger autoApproveTrigger on Quote__c(after update,after insert) { for (Quote__c a : Trigger.new) { if(a.Quoted_Cost_Unit_Price__c >= a.Field_Min1__c){ //Unit cost_less_than_Field_Min.Quote(a.Id); }else{ //do nothing for other record type case. } } }can someone help on it?
You can invoke using the following steps, make sure that the approval process is in active state.
Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest();
req1.setComments('Submitting request for approval.');
req1.setObjectId(mr.id);
Approval.ProcessResult result1 = Approval.process(req1);