flow designer script:

Thomas99
Tera Contributor

Help with flow designer script: 

 

I call this script in the worknotes of a catalog task in flow designer. 

 

var ritmSysId = fd_data.trigger.request_item.sys_id;
var rec = new GlideRecord('sc_req_item');
rec.get(ritmSysId);
var variableDisplayValue = rec.variables.building.getDisplayValue();
return "Building:" + variableDisplayValue;
 
 
I now need another variable to added " u_city" in the work notes
 
City: 
Building: 
 
Note: I cannot simply drag and drop variables in the worknotes as its a look-up select box, which would then populate sysid. 
 
 
 
2 ACCEPTED SOLUTIONS

Sagar Pagar
Tera Patron

Hi @Thomas99,

 

Try this updated scripts and let me know.

 

var ritmSysId = fd_data.trigger.request_item.sys_id;

var rec = new GlideRecord('sc_req_item');
rec.get(ritmSysId);
var cityName = rec.variables.u_city.getDisplayValue();
var buildingName = rec.variables.building.getDisplayValue();

return "City:" + cityName + "\n" + "Building:" + buildingName;

 

 

If my response helps you resolve your issue. Kindly mark it as helpful & correct. It will be helpful to future readers! 👍🏻
Thanks,
Sagar Pagar

The world works with ServiceNow

View solution in original post

Sandeep Rajput
Tera Patron
Tera Patron

@Thomas99 Here is the updated script.

 

var ritmSysId = fd_data.trigger.request_item.sys_id;
var rec = new GlideRecord('sc_req_item');
rec.get(ritmSysId);
var variableDisplayValue = rec.variables.building.getDisplayValue();
var cityDisplayValue = rec.variables.u_city.getDisplayValue();

return "City: " + cityDisplayValue+"Building: " + variableDisplayValue;

View solution in original post

3 REPLIES 3

Sagar Pagar
Tera Patron

Hi @Thomas99,

 

Try this updated scripts and let me know.

 

var ritmSysId = fd_data.trigger.request_item.sys_id;

var rec = new GlideRecord('sc_req_item');
rec.get(ritmSysId);
var cityName = rec.variables.u_city.getDisplayValue();
var buildingName = rec.variables.building.getDisplayValue();

return "City:" + cityName + "\n" + "Building:" + buildingName;

 

 

If my response helps you resolve your issue. Kindly mark it as helpful & correct. It will be helpful to future readers! 👍🏻
Thanks,
Sagar Pagar

The world works with ServiceNow

Sandeep Rajput
Tera Patron
Tera Patron

@Thomas99 Here is the updated script.

 

var ritmSysId = fd_data.trigger.request_item.sys_id;
var rec = new GlideRecord('sc_req_item');
rec.get(ritmSysId);
var variableDisplayValue = rec.variables.building.getDisplayValue();
var cityDisplayValue = rec.variables.u_city.getDisplayValue();

return "City: " + cityDisplayValue+"Building: " + variableDisplayValue;

Thomas99
Tera Contributor

Thanks guys! It worked