Skip to content

Instantly share code, notes, and snippets.

@cmcdevitt
Created January 28, 2014 20:54
Show Gist options
  • Save cmcdevitt/8676214 to your computer and use it in GitHub Desktop.
Save cmcdevitt/8676214 to your computer and use it in GitHub Desktop.
ServiceNow email script list catalog item and varables
<mail_script>
template.print("<p></p>Requested items:\n");
var gr = new GlideRecord("sc_req_item");
gr.addQuery("request", current.sysapproval);
gr.query();
while(gr.next()) {
template.print(gr.number + ": " + gr.cat_item.getDisplayValue() + ", Stage: " + gr.stage.getDisplayValue() + "\n");
for (key in gr.variables) {
var v = gr.variables[key];
if(v.getGlideObject().getQuestion().getLabel() != '') {
template.space(4);
template.print(' ' + v.getGlideObject().getQuestion().getLabel() + " = " + v.getDisplayValue() + "\n");
}
}
}
</mail_script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment