Using flow variable to ask for approvals

thrsdy1512
Tera Expert

Hi I am using a scripted flow variable to get the data for affected CI support groups.

In the subsequent step I am trying to set a 'Ask for Approval' action to ask for approval from the support group, what do I need to select in the Record / Table / Approval Field / Journal Field sections?

thrsdy1512_0-1741852904605.png

 

 

Script:

var appr = fd_data._10__for_each.item.ci_item.support_group;
var apprgrp = fd_data.flow_var.affected_cis_support_groups;
if(appr != '' && apprgrp.indexOf(appr)==-1){
    if(apprgrp == ''){
        return appr.toString();
    }else{
        return apprgrp + ',' + appr.toString();
    }
}else{
    return apprgrp.toString();
}
3 REPLIES 3

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @thrsdy1512 

 

It depends on the trigger. If you are updating or creating a record, and you need to request approval, you can use dot-walking to the support group in that case.

 

AGLearnNGrow_0-1741853316763.png

 

https://www.servicenow.com/docs/bundle/yokohama-build-workflows/page/administer/flow-designer/refere...

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

The flow is execute when a change request is raised. There are several types of approvals that are being trigged depending on the scenario but I need the flow to trigger approvals for the affected CI support groups. The affected CI is in task_ci , the CI itself is in cmdb_ci and the change request is in change_request. I am not sure which table i should be referencing in this part of the flow to achieve the desired outcome.

I have tried dotwalking and I can get to the affected CI support group that way but as the field references sys_user_group table, I am unable to apply 'ask an approval' action to it & get this error:

 

thrsdy1512_0-1741865358614.png

 

Suthan S
Tera Expert

You can use the OOB field such as 

1. Support Group 

2. Approval Group.

 

By using these fields you can use CMDB table alone to trigger your approval.

 

SuthanS_0-1741854481026.png