GlideappVariablePoolQuestionSet - Possible to filter based on a true/false field on the variable?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-25-2024 07:24 AM
I need to include a couple variables on notifications. I am having trouble finding information on
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(item.sys_id);
set.setTaskID(current.sys_id);
set.load();
var vs = set.getFlatQuestions();
if(vs.size() == '0' || vs.size() == '')
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-03-2024 07:22 AM
Struggling to get this working according to the requirements. Got closer with the function
(function runMailScript(current, template, email, email_action, event) {
var item = new GlideRecord("sc_req_item");
item.addQuery("sys_id", current.sysapproval);
item.query();
while (item.next()) {
var keys = new Array();
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(item.sys_id);
set.load();
var vs = set.getFlatQuestions();
if(vs.size() == '0' || vs.size() == '')
{
return;
}
else
{
//template.print("<hr style='width: 98%;' /><p><b><u>Approval Details</u></b></p>");
for (var i = 0; i < vs.size(); i++) {
if (!vs.get(i).isVisibleSummary()) {
continue;}
if (vs.getLabel() != "" && vs.getDisplayValue() != "" && vs.getDisplayValue() != 'false' && vs.get(i).getDisplayValue() != 'false' && vs.get(i).getDisplayValue() != '') {
template.print("<p><b>" + vs.get(i).getLabel() + "</b>: " + vs.get(i).getDisplayValue() + "</p>");
}
}
}
}
})(current, template, email, email_action, event);
From my searching, using an onSubmit catalog client script would be unreliable to write to a field on the RITM as the RITM is busy being created onSubmit. I think I could use an after insert business rule perhaps to capture variables flagged as include=true? Since the LABEL is available in the GlideappVariablePoolQuestionSet, I can populate an array with the include = true variable.label and add that to the IF check on the email script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-27-2025 10:08 PM
Hi jlaps,
Did you get any solution for this issue. I'm facing similar issue, causing slowness due to use of custom field to show / hide variable in the generic notifications.