+ Start a Discussion
vish hvish h 

Custom approval process

Hi,

I have a requirement to create Purchase order requistions. In short, to generate any PO order in pdf, first submitted PO request  should get approvals from RU unit heads ( 4 to 6 member approvals based on cost) . Client has many RU units(>100) each RU unit has different approvers.
>> Suggestion is given to create RU unit object and save/define the RU approvers in the object.  
>> Whenver PO request is created with RU unit number, that should read the RU approvers from RU object and get the approvals from concerned approvers defined in the object through approval process.

Can we achieve above requirement? if so, how can we achieve this?  Please give me hints.

Thanks
Vish
Amit Chaudhary 8Amit Chaudhary 8
You can submit multiple Records for approval, sample code below
List<Approval.ProcessSubmitRequest> requests = new List<Approval.ProcessSubmitRequest> ();
     for (Id oppId: opportunities) {
                    Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest();
                    req1.setComments('Submitting request for approval ');
                    req1.setObjectId(oppId);
                    requests.add(req1);
        }


      Approval.ProcessResult[] processResults = null;
                try {
                    processResults = Approval.process(requests, true)
    }catch (System.DmlException e) {
        System.debug('Exception Is ' + e.getMessage());
    }
http://shivasoft.in/blog/salesforce/dynamic-approval-process-based-on-the-apex-and-trigger/
http://releasenotes.docs.salesforce.com/en-us/spring15/release-notes/rn_forcecom_process_visually_automate.htm#rn_forcecom_visually_automate

Please let us know if this will help you
vish hvish h
Hi Amit, Thanks for your response. I think first we need to create approval process manually, Then only we can go for multi approver and auto approval. As per my knowledge we cannot set the dynamic fields while creating approval process. Here is the requirement is to get the list of RU approvers based on RU number from RU object .. I'm stuck here.. I'm not getting how to create approval process for this ... Any suggestions ?? Thanks Vish