Flow designer script for approvals

Alon Grod
Tera Expert

Hi,

 

what am i doing wrong?

why its not sending approval request to the group (im getting the log with the sys_id)

 

I attached image 

9 REPLIES 9

Mark Manders
Mega Patron

Why don't you just set the group? 


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Nawal Singh
Mega Guru

Hi @Alon Grod ,

 

Please review the screenshot for approval script-

NawalSingh_0-1759133611766.png

and here is the code- 

 

if(fd_data.trigger.request_item.cat_item.u_require_manager_approval){
 var requestedfor=fd_data._1__get_catalog_variables.requested_for;
if(requestedfor){
   if(fd_data._1__get_catalog_variables.requested_for.manager.active){
    return "ApprovesRejectsAnyU["+fd_data._1__get_catalog_variables.requested_for.manager.sys_id+"]";
   }
}else if(fd_data.trigger.request_item.requested_for.manager.active){
     return "ApprovesRejectsAnyU["+fd_data.trigger.request_item.requested_for.manager.sys_id+"]";
}
 
if your group is fixed or static you can directly select using the group picker
 
 
If you found my response helpful, please mark it as helpful and accept it as the solution.

Thank you
Nawal Singh

 

 

Voona Rohila
Mega Patron
Mega Patron

Hi @Alon Grod 

Declare the Variable before the if statement block.

var gpz= '';
if(gr.next())
{
gpz= gr.sys_id;
}

 


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

@Voona Rohila Still

not working