The CreatorCon Call for Content is officially open! Get started here.

getFlatQuestions()

479342
Kilo Contributor

What is the functionality of getFlatQuestions()?means what it does in a package.Someone please help me to understand the code


template.print("Summary of RFC Options:\n");
var keys = new Array();
var set = new Packages.com.glideapp.questionset.SequencedQuestionSet();
set.setTableName('change_request');
set.setTableSysID(current.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");
}
}

2 REPLIES 2

justin_drysdale
Mega Guru

As end users those details are hidden from us officially. From the looks of the for loop right after the function call, it looks like it collects and stores data into an array...


CapaJC
ServiceNow Employee
ServiceNow Employee

I think that method gets all variables, in order, minus any container or variable set formatting you would normally see on the form.

That said, I've never played with it.