I need to have a link in notifications to direct the user to the platform or portal based on role
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2023 11:15 AM
I'm trying to figure out how I can change the link in a notification to bring a user to the proper platform or portal to view their ticket. Users with a certain role should always be directed to the platform where all other users need to be directed to the portal. The watch list can contain both types of users. I'm trying to figure out how I could change the link to the proper URL. Do I need to create a event to determine what link to put in place or is there something I can do in the email notification script?
Does anyone know how ServiceNow process notifications for each recipient?
Does ServiceNow send notifications out based on notification device type and includes all recipients that have that notification type or does it look at all recipients individually and sends notifications based on each user in the recipient list?
I see many forum questions and answers but it isn't clear to me if they have separate notification records or if they are handling things within an email notification script. A notification can have many different recipeints from caller to requester to members of a group to members in watch list and/or work notes list.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2023 01:51 PM
Hi @abrahams ,
Hope you are doing good.
Your requirement can be achieved in a single email notification with the help of email script
Please refer below example
Email Script :
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
if (gs.hasRole("itil")) {
template.print("/incident.do?sys_id=" + current.sys_id);
} else {
template.print("/sp?sys_id=" + current.sys_id + "&view=sp&id=ticket&table=incident");
}
})(current, template, email, email_action, event);
Just call the script in the notification
<p><a href="${mail_script:email_script_name}">Click Me</a></p>
Please mark this response as correct or helpful if it assisted you with your question.
Regards,
Harshal