- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-24-2018 03:13 AM
Hi,
I've currently got a notification script set up to paste an ESS link if the user is not an ITIL user, but to do the opposite if they are. I was just wondering if there was any way I could change the script so that it's got the URL variable of the site, so that I do not have to make seperate changes for both dev and live versions of the instance? I mean in the way like ${URI_REF} does.
Here is my code so far, it works but if I was to clone live over my dev environment the links would all be broken as they'd point to the live URL:
if (gs.getUser().getUserByID(current.getValue('caller_id')).hasRole('itil') == true){
return '${URI_REF}';
} else if (gs.getUser().getUserByID(current.getValue('caller_id')).hasRole('itil') != true){
return '<a href="https://MyCompanyDev.service-now.com/ESS?sys_id=${sys_id}&view=sp&id=ticket&table=incident ">${number}</a>';
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-24-2018 03:18 AM
Hi try below
return "<a href=" + gs.getProperty('glide.servlet.uri') + "/ESS?>LINK</a>";

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-24-2018 03:18 AM
Try
var instance_name = gs.getProperty('glide.servlet.uri');
return '<a href="+instance_name+"/ess?...............................</a>';
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-24-2018 03:18 AM
Hi try below
return "<a href=" + gs.getProperty('glide.servlet.uri') + "/ESS?>LINK</a>";
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-24-2018 03:31 AM
Thank you very much, that is perfect for what I need.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-24-2018 03:22 AM
Hi Michel,
You can use the ServiceNow Properties to get the instance Name or URL
var instanceURL = gs.getProperty('glide.servlet.uri');
var instanceName = gs.getProperty('instance_name');
Ex:
return '<a href="'+instanceURL+'/ESS?"'
I hope it will work for you