
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2023 11:43 PM
Hi There,
I have one Requirement on Request Table,
when Request is created at that it will go to Approval, in previous Requirements i had Approval on RITM, but i need to achieve this on REQ now.
In That Notification Body, i have to add Request Details, for that i have written one mail Script FOR RITM, but i'm not sure, how can i change for Request table,
Please find the below mail script i have written for RITM Approval,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023 02:09 AM
Hello,
Base on what you want to send in the email you can change the values in the print. But this way you can navigate the sc_request when approval is for the request
Can you please try the below:-
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
var gr = new GlideRecord("sc_request");
gr.addQuery("sys_id", current.sysapproval);
gr.query();
while(gr.next()) {
var gr1= new GlideRecord("sc_req_item");
gr1.addQuery("request", gr.sys_id);
gr1.query();
if(gr1.next()) {
var varown = new GlideRecord('sc_item_option_mtom');
varown.addQuery("request_item", gr1.sys_id);
varown.addQuery("sc_item_option.value != ''null'' ");
varown.orderBy("sc_item_option.order");
varown.query();
template.print('<table cellspacing="5" cellpadding="5" width="100%" style="border-color:#000000; height:30px; border-collapse:collapse;">');
template.print('<tr><th style="width: 35%; border:1px solid black;" align="left">Variable</th><th style="border:1px solid black;" align="left">Answer</th></tr>');
while (varown.next()){
var visible = varown.sc_item_option.item_option_new.visible_summary;
var question = GlideappAbstractChoiceListQuestion.getQuestion(varown.sc_item_option.item_option_new);
question.setValue(varown.sc_item_option.value);
if (question.getLabel() != "" && question.getDisplayValue() != "" && visible == true && question.getLabel() != "null" && question.getDisplayValue() != "undefined"){
template.print('<tr><td style="border:1px solid black;">' + question.getLabel() + '</td><td style="border:1px solid black;"><strong>' + question.getDisplayValue() + '</strong></td></tr>');
}
}
template.print('</table>');
}
}
})(current, template, email, email_action, event);
Please mark my answer as correct based on Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023 02:09 AM
Hello,
Base on what you want to send in the email you can change the values in the print. But this way you can navigate the sc_request when approval is for the request
Can you please try the below:-
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
var gr = new GlideRecord("sc_request");
gr.addQuery("sys_id", current.sysapproval);
gr.query();
while(gr.next()) {
var gr1= new GlideRecord("sc_req_item");
gr1.addQuery("request", gr.sys_id);
gr1.query();
if(gr1.next()) {
var varown = new GlideRecord('sc_item_option_mtom');
varown.addQuery("request_item", gr1.sys_id);
varown.addQuery("sc_item_option.value != ''null'' ");
varown.orderBy("sc_item_option.order");
varown.query();
template.print('<table cellspacing="5" cellpadding="5" width="100%" style="border-color:#000000; height:30px; border-collapse:collapse;">');
template.print('<tr><th style="width: 35%; border:1px solid black;" align="left">Variable</th><th style="border:1px solid black;" align="left">Answer</th></tr>');
while (varown.next()){
var visible = varown.sc_item_option.item_option_new.visible_summary;
var question = GlideappAbstractChoiceListQuestion.getQuestion(varown.sc_item_option.item_option_new);
question.setValue(varown.sc_item_option.value);
if (question.getLabel() != "" && question.getDisplayValue() != "" && visible == true && question.getLabel() != "null" && question.getDisplayValue() != "undefined"){
template.print('<tr><td style="border:1px solid black;">' + question.getLabel() + '</td><td style="border:1px solid black;"><strong>' + question.getDisplayValue() + '</strong></td></tr>');
}
}
template.print('</table>');
}
}
})(current, template, email, email_action, event);
Please mark my answer as correct based on Impact.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023 03:07 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023 03:09 AM
Hello,
If my answer helped you can you also mark it as correct.
Thanks.