Need to check if we can include details from RITM variables in the email Body
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2024 05:42 AM
Hello,
Can we include details from RITM variables like catalog item in the email Body.
Flow is like first case will be created, then request & RITM.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2024 07:16 AM
To clarify the ask, you have a Catalog Item (not a record producer), which generates a Requested Item. Somewhere along the way, a Case will be created, and you want to send a notification when that happens. Is that correct?
How are you creating the case?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2024 08:50 AM
On the portal, Once we submit the catalog item. Case will be generated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2024 07:21 AM
Hi @is_12 ,
Please write an email script & call it in your notification.
Name = "example_name"
(function runMailScript(current, template, email, email_action, event) {
var gr = new GlideRecord('sc_cat_item');
gr.addQuery('sys_id', current.sys_id);
gr.query();
if (gr.next())
{
if (gr.cat_item == 'sys_id_of_catalog1') {
template.print(current.variables.server_1);
template.print(current.variables.server_2);
template.print(current.variables.server_3);
email.setSubject("For catalog item 1");
}
else if (gr.cat_item == 'sys_id_of_catalog2') {
template.print(current.variables.database1);
template.print(current.variables.database2);
template.print(current.variables.database3);
email.setSubject("For catalog item 2");
}
}
})(current, template, email, email_action, event);
Then call this email script in the notification
${mail_script:example_name}
Accept and hit Helpful if it helps.
Thanks & Regards,
Sumanth Meda
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2024 09:04 AM
Hi @is_12
You can write email script and call mail script in notification:
${mail_script:show_variables}
Sample mail script:
template.print("Request item summary:\n");
var item = new GlideRecord("sc_req_item");
item.addQuery("case_id", current.sys_id); //Add your own Query
item.query();
if (item.next()) {
var keys = new Array();
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() != '') {
template.space(4);
template.print(' ' + vs.get(i).getLabel() + " = " + vs.get(i).getDisplayValue() + "\n");
}
}
}
</mail_script>
If my response proves useful, please indicate its helpfulness by selecting "Accept as Solution" and " Helpful."
Thanks!
