Handle multiple set of approvals

ravin
Giga Contributor

We have a scenario to handle multiple set of approvals on a RITM.

From a catalog form we are dynamically allowing user to a add a row with 3 columns

Column 1: Business Service (reference field)

Column 2: Dataset

Column 3: Access Level (3 radio buttons: Read/Write/Delete)

I have created a UI Page with Add/Delete Row functionality.

Finally am able to get the selected Business Services into an array on a workflow.

Now, for each Business Service there are 3 users (Application Owner, Custodian1 & Custodian2) approvals to be generated.

If 10 Business services selected on a form, 10 sets of approvals to be generated. All sets should be handled individually, where if one approves remaining 2 should be set as 'No Longer Required'

answer = [];        

var app = current.variables.services; //

var gr = new GlideRecord('cmdb_ci_service');

gr.addQuery('sys_id', 'IN', app.split(','));

gr.query();

while(gr.next()){
answer.push(gr.getValue('u_ao')); // Application Owner
answer.push(gr.getValue('u_c1')); // Custodian 1
answer.push(gr.getValue('u_c2')); // Custodian 2

}

It's code on Approval User activity. It's generating all necessary approvals. But, one approved all remaining setting to either 'No Longer Required' or remaining in 'Requested' state.

Kindly help me out how can we handle the approvals set basis in my scenario.

1 ACCEPTED SOLUTION

ravin
Giga Contributor

I've done this by using RUN SCRIPT and Business Rule.



1. RUN Script - Generating approvals manually by initializing a GlideRecord on sysapproval_approver table.


2. Business Rule (after, update, on sysapproval_approver) - on approval verifying for the other approvals on same set and setting those to 'No Longer Required'. On every approval getting the count of all approvals on sc_req_item to get the info of approved, rejected, no longer required. Based on that am setting the approval, stage & state value of RITM.



Thank you !


View solution in original post

5 REPLIES 5

ravin
Giga Contributor

I've done this by using RUN SCRIPT and Business Rule.



1. RUN Script - Generating approvals manually by initializing a GlideRecord on sysapproval_approver table.


2. Business Rule (after, update, on sysapproval_approver) - on approval verifying for the other approvals on same set and setting those to 'No Longer Required'. On every approval getting the count of all approvals on sc_req_item to get the info of approved, rejected, no longer required. Based on that am setting the approval, stage & state value of RITM.



Thank you !