- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2022 09:01 AM
Hi Team, Needed your help to understand this API # GlideappSequencedQuestionSet into Service now.
We have Change Management approval process and this API is getting used to display all variables of Record Producers into mail script into notification.
Either variables are active or false, all variables are getting displayed.
We would like to exclude variables those are not active and we would like to exclude multirow variables as well.
Please help if anyone is aware about this, appreciate your help.
Thanks, Basant
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2022 09:31 AM
Hi @basantsoni ,
I think it is better to use below API
var vs = new GlobalServiceCatalogUtil().getVariablesForTask(current.sysapproval.getRefRecord(), true);
for (var i=0; i < vs.length; i++)
{
var isMRVS=lbl=vs[i].multi_row+"";
var lbl=vs[i].label+"";
var dis=vs[i].display_value+"";
var visible=vs[i].visible_summary+"";
if(isMRVS=='true')
{
var vArr=vs[i];
template.print("<div>" + "<strong>" + lbl + "</strong></div><hr>");
for (var j=0; j < vArr.table_variable.length; j++)
{
template.print("<div><strong>Row: </strong>" + (j+1) + "</div>");
var tblArr=vArr.table_variable[j];
for (var k=0; k < tblArr.length; k++)
{
var mrvslbl=tblArr[k].label+"";
var mrvsdis=tblArr[k].display_value+"";
if(mrvslbl != '' && mrvsdis!='' && mrvsdis!='false')
{
template.print("<div>" + "<strong>" + mrvslbl + "</strong>" + ": " + mrvsdis + "</div>");
}
}
template.print("<hr>");
}
}
else
{
if (lbl != '' && dis!='' && dis!='false' && visible=='true') {
template.print("<div>" + "<strong>" + lbl + "</strong>" + ": " + dis + "</div>");
}
}
}
Please make necessary changes as per your need.
Please mark the answer as correct, If I answered your query.
Will be helpful for other visitors looking for similar questions.
Regards
Saurabh
Thanks and Regards,
Saurabh Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2022 09:31 AM
Hi @basantsoni ,
I think it is better to use below API
var vs = new GlobalServiceCatalogUtil().getVariablesForTask(current.sysapproval.getRefRecord(), true);
for (var i=0; i < vs.length; i++)
{
var isMRVS=lbl=vs[i].multi_row+"";
var lbl=vs[i].label+"";
var dis=vs[i].display_value+"";
var visible=vs[i].visible_summary+"";
if(isMRVS=='true')
{
var vArr=vs[i];
template.print("<div>" + "<strong>" + lbl + "</strong></div><hr>");
for (var j=0; j < vArr.table_variable.length; j++)
{
template.print("<div><strong>Row: </strong>" + (j+1) + "</div>");
var tblArr=vArr.table_variable[j];
for (var k=0; k < tblArr.length; k++)
{
var mrvslbl=tblArr[k].label+"";
var mrvsdis=tblArr[k].display_value+"";
if(mrvslbl != '' && mrvsdis!='' && mrvsdis!='false')
{
template.print("<div>" + "<strong>" + mrvslbl + "</strong>" + ": " + mrvsdis + "</div>");
}
}
template.print("<hr>");
}
}
else
{
if (lbl != '' && dis!='' && dis!='false' && visible=='true') {
template.print("<div>" + "<strong>" + lbl + "</strong>" + ": " + dis + "</div>");
}
}
}
Please make necessary changes as per your need.
Please mark the answer as correct, If I answered your query.
Will be helpful for other visitors looking for similar questions.
Regards
Saurabh
Thanks and Regards,
Saurabh Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2022 06:31 AM
Thanks Saurabh for your valuable help and reply.