Show catalog variable on a approval form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2024 03:35 AM
Hi Community,
I was wondering if it's possible to show catalog item variables on a RITM approval form?
So, I have the below email that goes out for approval for firewall changes in this example:
Clicking the approve link takes them to this form:
Is it possible to have the approval details showing on this form instead of having to hover over the icon then drill down to the RITM level to the see the details
When looking at the form design it only shows the approval summary and cannot see anything else.
Hope this makes sense.
Many thanks,
Alex

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2024 04:03 PM
You need to add a mail script. Below is one setup to be used on multiple source tables including approval. The only thing this will not display in multi-row variable sets.
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
var item_sys_id;
var tableName = current.getTableName();
if (tableName == 'sysapproval_approver') {
item_sys_id = current.sysapproval;
} else if (tableName == 'sc_task') {
item_sys_id = current.request_item.sys_id;
} else if (tableName == 'sc_req_item') {
item_sys_id = current.sys_id;
} else {
item_sys_id = '';
}
//gs.log("SYS ID : "+item_sys_id);
var item = new GlideRecord("sc_req_item");
item.addQuery("sys_id", item_sys_id);
item.query();
while (item.next()) {
template.print("<div style='font-size:12pt;font-family:Arial, Helvetica, sans-serif;'><span><b>Options</b>:</span><br />");
var keys = [];
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(item.sys_id);
set.load();
var vs = set.getFlatQuestions();
for (var i = 0; i < vs.size(); i++) {
if (vs.get(i).getLabel() != '') { //This displays all of the variables (answered/unanswered)
var val = vs.get(i).getDisplayValue();
if (val != '') {
template.space(4);
template.print(vs.get(i).getLabel() + " : " + val + "<br />");
}
}
}
template.print("</div>");
}
})(current, template, email, email_action, event);