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

Harish KM
Kilo Patron
Kilo Patron

Check wait for condition



find_real_file.png


Regards
Harish

ravin
Giga Contributor

Thank you for your response Harish, that would possible if we have single set of approvals.


Alikutty A
Tera Sage

Hi Ravinder,



When you say 10 sets, I doubt if you can use approval user activity. It consider all users as single set but there is an option to wait for approval based on script.



condition.jpg



You can set approval states to approved or rejected here but again I am not sure if you can differentiate each sets of yours



Your requirement would have been simple if you are able to add the 3 users in a group and use the approval-group activity as this will group the approvals based on 10 different sets




Thanks


Please Hit like, Helpful or Correct depending on the impact of the response


ravin
Giga Contributor

Alikutty Karupamveetil, Thank you for your response. Yes, it's not differentiating the sets.



Adding the users to group is not recommended, so I couldn't go with that approach.