- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2019 07:31 AM
Hi guys,
I need to send a notification with a link to a survey when incident is closed. All conditions has been set, but I need the final peace of the puzzle.
I am using a business rule that triggers the notification containing the email_scripts. In the business rule I need to define the event.parm2 and it is here I am having some trouble.
I need the sys id of the assessment instance to be added to the variable url:
var user = current.caller_id;
var gr = new GlideRecord ('asmt_assessment_instance');
gr.addQuery('task_id', current.number);
gr.query();
if(gr.next()){
var sysid = gr.sys_id;
var url = 'https://ossdev.service-now.com/ess?id=take_survey&instance_id='+sysid;
}
gs.eventQueue('incident.survey', current, user, url);
Somehow it is not fetching the sys_id of the instance. Any ideas?
Thanks guys,
Robin
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2019 08:40 AM
Hi Robin,
In your query, try using the sys_id of the task to query instead of the number. Also, I like to use getUniqueValue() instead of calling the sys_id, it's more reliable.
var user = current.caller_id;
var ai = new GlideRecord ('asmt_assessment_instance');
ai.addQuery('task_id', current.getUniqueValue());
ai.query();
if(ai.next()){
var sysid = ai.getUniqueValue();
var url = 'https://ossdev.service-now.com/ess?id=take_survey&instance_id='+sysid;
}
gs.eventQueue('incident.survey', current, user, url);
Let me know if that worked!
If my answer was helpful or correct, please mark it as such. 🙂
Thanks,
Josh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2019 08:40 AM
Hi Robin,
In your query, try using the sys_id of the task to query instead of the number. Also, I like to use getUniqueValue() instead of calling the sys_id, it's more reliable.
var user = current.caller_id;
var ai = new GlideRecord ('asmt_assessment_instance');
ai.addQuery('task_id', current.getUniqueValue());
ai.query();
if(ai.next()){
var sysid = ai.getUniqueValue();
var url = 'https://ossdev.service-now.com/ess?id=take_survey&instance_id='+sysid;
}
gs.eventQueue('incident.survey', current, user, url);
Let me know if that worked!
If my answer was helpful or correct, please mark it as such. 🙂
Thanks,
Josh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2019 11:42 PM
Josh, you are a hero! Thank you!!