- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-21-2019 07:00 AM
Hi There,
I have an email notification, where I need to differentiate the hyper link of the Incident Number(URI_REF) to whom it is sending. For example, if the recipient user has any roles it needs to send to ServiceNow View, else to Service Portal View. I had created the below email notification script, but every time(User with roles or without roles) it send the same notification URL. Can any one give me some help on this please.
// Add your code here
function createLinkForObject(strTableName, strSysID){
return '<a href="' + gs.getProperty('glide.servlet.uri') + gs.generateURL(strTableName, strSysID) + '">Click here</a>';
}
var user = gs.getUser().hasRoles();
if(gs.getUser().hasRoles()){
//var html = '<a href="' + gs.getProperty('glide.servlet.uri') + 'sp?id=ticket&table=incident&sys_id=' + current.sys_id + '">Click here</a>';
//print the html variable
template.print('${URI_REF}');
}
else {
gs.log("Entered else");
var tbl = current.getTableName();
var sysID = current.sys_id;
var link = createLinkForObject(tbl,sysID);
template.print(link +" to see full details.");
}
Solved! Go to Solution.
- Labels:
-
Notifications
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2019 10:30 AM
Hi Ryan,
Thanks for the reply. If a notification is sent to a group that has users both with roles and without roles not sure how to achieve this.
Thanks,
Bhuvan B.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-05-2019 05:44 AM
The first would need to be the suffix of your portal URL. So, if the portal URL is: "INSTANCENAME.service-now.com/sp", you need create that property and add "sp" to it.
If there are any users with roles but you still want to route to the portal instead (like users with the sn_internal role, or approval role), you need a comma delimited list of those roles in that property (which you'll also need to create).
And lastly, this property just enables the toggling between a form view and ticket view. Simply enter "ticket" if you want the end user being brought to the typical ticket view in the portal:
Or "form" if you prefer something more closely aligned with the backend SN view:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-05-2019 06:56 AM
Thank you so much Ryan. It worked. Thanks a lot.
Thanks,
Bhuvan B.