Mail script - print incident number and short description using survey trigger_id
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2018 09:02 AM
Hi Community,
I'm trying to do a simple thing, that is print the Incident number and short description in the notification email that is sent when a survey is created.
I've tried to do the following:
var inc = current.trigger_id;
var gr = new GlideRecord("incident");
gr.get(inc);
template.print(gr.number+": "+gr.short_description);
But it doesn't seem to work.
trigger_id is a Document ID type field, so in theory it contains the sys_id of the record that generated the survey.
In my notification, I don't have any output being printed.
Any ideas on this?
Thank you in advance
Hugo
Labels:
- Labels:
-
Scripting and Coding
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2018 02:30 AM
Any help on this?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2018 08:42 AM
I've fixed it.
var inc = current.trigger_id;
var gr = new GlideRecord("incident");
gr.addQuery("sys_id", inc);
gr.query();
if (gr.next()) {
template.print(gr.number+": "+gr.short_description);
}