variables translated in notification email
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-31-2023 05:15 AM - edited 12-31-2023 05:57 AM
Hey
I created a form u_support_feedback with the field u_feedback_subject - a choice type field, whose values in the field exist in two languages both Hebrew and English.
I need to add a mail script to the notification that will retrieve the values for me only when the language =he.
I solved the answer with glide record but it doesn't work:
I would be happy to help what I am missing in the code so that the value from the query is returned to me in the notification
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-31-2023 07:01 AM
Hi @Shir Sharvit,
instead of returning the value, you need to use template.print() to print it to the email body.
(function runMailScript(current, template, email, email_action, event) {
var gr = new GlideRecord('sys_choice');
gr.addQuery('name', 'u_support_feedback');
gr.addQuery('element', 'u_feedback_subject');
gr.addQuery('value', current.u_feedback_subject);
gr.addQuery('language', 'he');
gr.query();
if(gr.next()) {
var subjectValue = gr.getValue('label');
template.print(subjectValue);
}
// If no matching record found, the function will return undefined by default
})(current, template, email, email_action, event);
Best regards,
Rene