Can I separate catalog item variables and its variable set in an email script
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2024 11:13 AM
Hello,
I'd like to know if it's possible to create some kind of distinction between the general catalog item variables and a variable set within the item. In this instance, we have a variable set named 'user_access_changes' and this is the script I've been working on. Currently, it pools all of the variables and variable set into one sheet in the email with no variable set highlighted. I'd like to either section off the variable set to separate it, or even just highlight the variables associated with the variable set.
// Print header for system access requested
template.print("<b>System Access Requested:<br><br></b>");
// Load variable set variables
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(current.getValue('sysapproval'));
set.load();
var vs = set.getFlatQuestions();
// Iterate through the variables and highlight only those inside the "user_access_changes" variable set
for (var i = 0; i < vs.size(); i++) {
// Check if the variable belongs to the "user_access_changes" variable set
if (vs.get(i).getVariableSetName() == 'user_access_changes' &&
vs.get(i).getDisplayValue() != '' &&
vs.get(i).getDisplayValue() != 'false') {
// Highlight the variable
template.print('<span style="color: #FF0000;"><b>' + vs.get(i).getLabel() + " : </b></span> " + vs.get(i).getDisplayValue() + '<br><br>');
} else if (vs.get(i).getDisplayValue() != '' &&
vs.get(i).getDisplayValue() != 'false') {
// Print other variables without highlighting
template.print('<span style="color: #993366;"><b>' + vs.get(i).getLabel() + " : </b></span> " + vs.get(i).getDisplayValue() + '<br><br>');
}
}
0 REPLIES 0