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.

How to get the back end name of a variable using set.getFlatQuestions()?

nandithaparuchu
Kilo Contributor

var set = new GlideappVariablePoolQuestionSet();

set.setRequestID(item.sys_id);

set.load();

var vs = set.getFlatQuestions();

for (var i=0; i < vs.size(); i++) {

if(vs.get(i).getLabel() != '') {

template.space(4);

template.print(' ' + vs.get(i).getLabel() + " = " + vs.get(i).getDisplayValue() + "\n");

In the above code , is there any way how to get the variable name(back end name) like how we are retrieving display value using "vs.get(i).getDisplayValue()"

1 ACCEPTED SOLUTION

Gurpreet07
Mega Sage

Hi Nanditha,



vs.get(i).getName()       will provide you with backend name of the variable.


View solution in original post

2 REPLIES 2

Gurpreet07
Mega Sage

Hi Nanditha,



vs.get(i).getName()       will provide you with backend name of the variable.


nandithaparuchu
Kilo Contributor

Thank u so much Gurpreet
It' working