Mail script - print incident number and short description using survey trigger_id

hugogomes
Giga Expert

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

2 REPLIES 2

hugogomes
Giga Expert

Any help on this?

hugogomes
Giga Expert

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);
}