- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023 06:08 PM
Hi guys.
I want to display the value obtained from the record producer in the email notification.
Is there any way?
Thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023 06:32 PM
@shibasou : There are a couple of ways to achieve this.
1. If you are mapping your record producer variables to fields on the target table, you can get values directly from the table fields. Ex: ${current.YOUR_FIELD_NAME}
2. If that's not the case, you can get the values from the "Question Answers" [question_answer] table. Below is the sample code, which you can configure in your email script and call the email script in your email notification. Ex: ${mail_script:YOUR_MAIL_SCRIPT_NAME}
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
var ql = new GlideRecord('question_answer');
ql.addQuery('table_sys_id', current.sys_id.toString());
ql.orderBy('order');
ql.query();
while (ql.next()) {
template.print(ql.question.getDisplayValue() + ": " + ql.value.getDisplayValue() + "\n");
}
})(current, template, email, email_action, event);
Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023 06:32 PM
@shibasou : There are a couple of ways to achieve this.
1. If you are mapping your record producer variables to fields on the target table, you can get values directly from the table fields. Ex: ${current.YOUR_FIELD_NAME}
2. If that's not the case, you can get the values from the "Question Answers" [question_answer] table. Below is the sample code, which you can configure in your email script and call the email script in your email notification. Ex: ${mail_script:YOUR_MAIL_SCRIPT_NAME}
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
var ql = new GlideRecord('question_answer');
ql.addQuery('table_sys_id', current.sys_id.toString());
ql.orderBy('order');
ql.query();
while (ql.next()) {
template.print(ql.question.getDisplayValue() + ": " + ql.value.getDisplayValue() + "\n");
}
})(current, template, email, email_action, event);
Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023 06:37 PM
Thank you, I'll give it a try.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023 06:39 PM - edited 12-20-2023 06:39 PM
@shibasou Sure...
Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.