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 return catalog variable label

Brian DeBlis
Tera Expert

I am trying to return the label of a catalog variable in flow designer. It seems like no matter what I do, I still get the value of the variable, which is true/false, or undefined. I have tried both items below and cannot get the label. I need to label to input into an action to change from false to true, so I need the label name. 

Here are my attempts:

var name = fd_data.trigger.request_item.variables.variable_name.getDisplayValue();
return name;
 
var name = fd_data._1__get_catalog_variables.variable_name.getDisplayValue();
return name;
1 ACCEPTED SOLUTION

mattystern
Kilo Sage

Hi Brian,

 

You'll need to define the requested item you are looking for and then use getLabel() to get the variable label. Example here:

 

 

var ritmSysId = fd_data.trigger.request_item.sys_id;
var rec = new GlideRecord('sc_req_item');
rec.get(ritmSysId);
var variableLabel = rec.variables.variable_name.getLabel(); //replace "variable_name" with the value of the variable you want the label of
return variableLabel;

 

 

 

For values, you can always use the "Get Catalog Variables" action and drag/drop pills.

View solution in original post

1 REPLY 1

mattystern
Kilo Sage

Hi Brian,

 

You'll need to define the requested item you are looking for and then use getLabel() to get the variable label. Example here:

 

 

var ritmSysId = fd_data.trigger.request_item.sys_id;
var rec = new GlideRecord('sc_req_item');
rec.get(ritmSysId);
var variableLabel = rec.variables.variable_name.getLabel(); //replace "variable_name" with the value of the variable you want the label of
return variableLabel;

 

 

 

For values, you can always use the "Get Catalog Variables" action and drag/drop pills.