The ${URI_REF} is redirecting to undefined page in notification.!! HELP..!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2018 07:24 AM
HI Developers,
I have created the notification on incident and included ${URI_REF} in the email script(along with some checks) and I have used that email script in the notification body section. Following is the script written in email script.
url variable contains the url for service portal. The business service is used that will trigger the event for the notification and it will send one parameter that contains this url value which is then used in the email script.
var url = event.parm2;
if(url!='') // User has no role so redirect to Service Portal
{
template.print('Click on the URL to view Incident - '+'<a href="'+url+'">' + current.number + '</a>');
}
else // User has Role so redirect to the Servicenow page
{
template.print('Click on the URL to view Incident – ${URI_REF}');
}
When the notification is triggered, I am getting the link but its redirecting to undefined page. The url to which its redirecting is as below: (Also check out the attachment)
https://instance.service-now.com/undefined
The Strange thing is the script --> "Click on the URL to view Incident – ${URI_REF}" is working fine with other notifications. But for only one notification its not working.
Can anyone please help me out on this asap. Thanks in advance.
Regards,
Snehal

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2018 07:45 AM
Change your script to this, run a test to generate your email, and then look in the system log and tell me what you get. Can you post a screenshot of your notification config? Is it being triggered by an event or some other condition?
var url = event.parm2;
gs.log('Email URL: ' + url + ' Number: ' + current.number);
if(url!='') // User has no role so redirect to Service Portal
{
template.print('Click on the URL to view Incident - '+'<a href="'+url+'">' + current.number + '</a>');
}
else // User has Role so redirect to the Servicenow page
{
template.print('Click on the URL to view Incident – ${URI_REF}');
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2018 07:57 AM
May be we can give try with below code,
var url = event.parm2;
if(url!='') // User has no role so redirect to Service Portal
template.print('<a href="' + gs.getProperty('glide.servlet.uri') + 'sp?id=ticket&table=incident&sys_id=' + current.sys_id + '">' + current.number + '</a>');
else{ // User has Role so redirect to the Servicenow page
var link = current.getLink();
template.print('Click on the URL to view Incident - '+ '<a href="' + link + '"');
}