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.

flow designer approval rules scripts

shruti2bhosale
Tera Contributor
I am trying to set requested for variable users manager.
but its not working.
 
var manager = fd_data.trigger.request_item.variables.requested_for.u_it_manager.toString();
var answer = [];
gs.addInfoMessage('Manager'+manager);
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('user', manager);
gr.query();

if (gr.next()) {
   
    return manager;


}
3 REPLIES 3

J Siva
Kilo Patron
Kilo Patron

HI @shruti2bhosale 
You can achieve this without script. PFB. Could you share your full requirement?

JSiva_0-1745738006383.png

PFB article on Scripted Approvals in Flow Designer with Flow Variables

https://www.servicenow.com/community/workflow-automation-blogs/scripted-approvals-in-flow-designer-w...

 

Regards,
Siva

shruti2bhosale
Tera Contributor

Hi Siva The approval should go to requested for manager and if manager is not available/empty then it should go to IT Manager group.

Hi @shruti2bhosale 

Please try below flow. 

Screenshot_20250428-062351.png

Manager approval:

Screenshot_20250428-062923.png

Group approval:

Screenshot_20250428-062953.png

 

Regards,

Siva