Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to access output of "Make decision" flow logic ?

Eddloupe
Tera Expert

I've created a decision table that returns group.

 

I'm trying to access the output of the make decision via inline script but it returns undefined.

var sApprList = fd_data.flow_var.approverlist;


if(fd_data._2__for_each.item.assignment_group){
    //This part
    sApprList += ',' + fd_data._3__make_a_decision.answer.u_approvergroup;
}

return sApprList;

 

I'm concatenating result separated by comma because i'm going to used it to an approval rule.

I'm expecting that it should return a sys_id of the group.

4 REPLIES 4

MattSN
Mega Sage

Not a direct answer to your question, however you might find it easier to build a subflow for handling the approval instead of an approval rule. Have a look at the OOB "Requested Item Manager Approval" subflow for an example to borrow from.

keshavkhandelwa
Tera Contributor

Hi @Eddloupe , I was also trying to access output of make decision. Does the above way worked for you? 
I was using this 

fd_data._6__make_a_decision.decision_table_multiple_result_record.result_elements.label it shows the following error Invalid reference to: fd_data._6__make_a_decision ...

 

Tai Vu
Kilo Patron
Kilo Patron

Hi @Eddloupe 

Let's try the below script.

 

fd_data._3__make_a_decision.answer.result_elements.u_approvergroup

 

OR

 

fd_data._3__make_a_decision.answer.result_elements.u_approvergroup.sys_id

 

 

Also make sure Use Branches unchecked in your step Make a decision.

 

Let me know if it works for you.

 

Cheers,

Tai Vu

Thomas Mueller2
Tera Contributor

Thanks for the code snippet. I was struggling with a similar approach as my variable was returning undefined.

'results_elements' was missing on my code - now I got the appropriate values!

fd_data._3__make_a_decision.answer.result_elements.u_approvergroup.sys_id