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.

Help with Flow Designer Script

Community Alums
Not applicable

 

Hi,

I have a requirement where Short Description should be auto populated based on the selection. Currently it is showing as () instead of value inside. Kindly help.

 

1.png

 

2.png

 

3.png

4.png

5.png

 

6.png

 

 

/*
**Access Flow/Action data using the fd_data object. Script must return a value. 
**Order number is offset by +1 in Error Handling Section.
**Available options display upon pressing "." after fd_data
**example: var shortDesc = fd_data.trigger.current.short_description;
**return shortDesc;
*/
var action = fd_data._1__get_catalog_variables.action;
var requested_for = fd_data._1__get_catalog_variables.requested_for_user.sys_id;
var service_account_string = fd_data._1__get_catalog_variables.service_account_s; //string
var service_account_arr = service_account_string.split(","); //array
var service_account_name_arr = [];
for(var i = 0;i<=service_account_arr.length;i++)
{
var gr = new GlideRecord('u_cmdb_ci_unix_service_account');
gr.addQuery('sys_id',service_account_arr[i]);
gr.query();
if(gr.managed_by != " "){
while(gr.next())
{
    if(gr.managed_by != requested_for){
      service_account_name_arr.push(gr.managed_by.name.toString());
    }

}
}
}
var msg = "Next step: Your request requires approval from IT Manager(s) - " + service_account_name_arr;
return msg;

 

 

 

 

 

1 REPLY 1

Sai_Charan_K
Kilo Sage

Hi @Community Alums,

Please let me know if you are available for a quick call to fix this issue as I require few more details from your end to fix this issue.

Thanks and Regards,
K. Sai Charan
Sr. ServiceNow Developer
Deloitte India