Display requested item stages in email
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi All,
I recently came across a requirement where I have to display the stages of an RITM along with current stage in the email sent to users.
For ex - these stages should be added in the email sent to user.
Suggest me on how can I achieve this ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Please follow below steps
1. Create a **Mail Script** under *System Notification > Email > Notification Email Scripts*, name it e.g. `ritm_stage_progress`.
2. Paste this script:
var html = '<table cellpadding="4" style="border-collapse:collapse;">';
var stg = new GlideRecord('content_item_stage');
stg.addQuery('item', current.cat_item);
stg.orderBy('order');
stg.query();
while (stg.next()) {
var isCurrent = (stg.getValue('name') == current.getValue('stage'));
html += '<tr><td style="'
+ (isCurrent ? 'font-weight:bold;color:#1a6ed8;' : 'color:#888;')
+ '">' + (isCurrent ? '➤ ' : ' ')
+ stg.getDisplayValue('name')
+ (isCurrent ? ' (Current)' : '')
+ '</td></tr>';
}
html += '</table>';
template.print(html);
3. In your Notification's email template/message body, add: ${mail_script:ritm_stage_progress}
4. Test on an RITM notification trigger — the current stage will show highlighted in the email.
**Note:** the field linking `content_item_stage` to the catalog item may be `item` or `sc_cat_item` depending on your instance version — check the table's dictionary if the query returns nothing.
Thanks,
Danish