Use Decision Builder with Flow Designer to pick Approvers

Community Alums
Not applicable

Hello ServiceNow friends,

I'm trying to utilize a decision table to pick out up-to 5 approvers. There are potentially 50+ approvers across 50+ conditions. Some approvers repeat across the conditions. Some conditions are repeated to accommodate multiple approvers. Execution is set: "Run all decisions that match".

I can see that the decision table record results are grabbing my 5 approvers, but when I try to use a 'for each' logic in flow designer to parse out approvals, it only generates 1 approval record, and the other 4 are never generated, even after I approve the 1st record, no other approvals get generated. I would like these approvals to be generated all at once, and then only require 1 approver to approve in order to move it to approved. 

Is there a way I can get it to generate all the approvals at once without grouping the users into a group and then using a group approval process? The grouping method would require more work to accomplish, but I was able to get this way to work the way I wanted. 

1 ACCEPTED SOLUTION

Muralidharan BS
Mega Sage
Mega Sage

Hi Dustin Taber,

Yes, there is an option for that, you have to use the flow variable for that. 

And before trying, I tried the for each as you did and requested for approval, the approval is triggered one by one for me, which means after the first user approved the second approval is triggered. If this is the end behaviour you need then debug your flow. 

If you would like to trigger all approvals at one and make any one approve it, then try this. 

1. create a flow variable with string type,

2. add the sysid to the flow variable in the for loop. 

3. ask an approval outside the for loop and use return statement instead of data picker.

My decision table

find_real_file.png

Assign the sysid of the user to the flow variable

flow variable = flow variable + result record's user's sysid

find_real_file.png

Ask for approval 

find_real_file.png

result

find_real_file.png

 

 

View solution in original post

8 REPLIES 8

Hi @elphilli ,

 

Yes, you can use decision table api to grab the output. 

 

something like this

 

 var dt = new sn_dt.DecisionTableAPI();
var inputs = {};
inputs['inputName'] = 'input value';

// output will be like
var response = dt.getDecision('ef4ff5ee97566110cc6e7ea3f153afe7', inputs); // sysid of the decision table
 var jsoncomponent = JSON.parse(response.result_elements); // decision output. 

 

You may have to dot walk the result component to specific element.

 

Thanks  

Hi Murali,

I have a similar requirement where my variable is country (look up select box type) . The values are coming from a custom table . And I need t use this variable as a base to generate an approval and task for each country. There are almost 10 countries. 

In the custom table the field is u_country and it is string type where i have imported the data to that table. 

How can I use a decision table here... Could you please help me. 

Community Alums
Not applicable

Hi Murali,

Thank you for that solution. That solved my issue completely. 

You've welcome!