Notification Email Script - System URL

michaelmorgan
Giga Contributor

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>';

}

1 ACCEPTED SOLUTION

rahulpandey
Kilo Sage

Hi try below


return "<a href=" + gs.getProperty('glide.servlet.uri') + "/ESS?>LINK</a>";


View solution in original post

5 REPLIES 5

David Pichard
Mega Guru

In my notification (not the template) I used this and it works as expected for ${glide.servlet.uri}:

<tr>
<td style="padding-left: 5px; padding-bottom: 10px;" colspan="3"><strong>Requested Item:</strong> <a href=" ${glide.servlet.uri}/nav_to.do?uri=sc_req_item.do?sys_id=${request_item.sys_id}">${request_item}</a> - ${request_item.cat_item}</td>
</tr>