Dynamic email links dependent on recipient role?

J Shone
Kilo Expert

As a system admin, i need the links included in notification sent out via email updated so that non-it users are directed to the portal whereas IT users are directed to the backend tool 

 

Links in email notifications currently direct the user to the tool/UI.  e.g. link button in resolve email> https://service-now.com/incident.do?sys_id=cce3ef25db12d010d282342dfdsfds3f3961968&sysparm_stack=incident_list.do?sysparm_query=active=true  

A better url to use for non-util users might be:      

https://service-now.com/nav_to.do?uri=%2Fincident.do%3Fsys_id%3Dcce3ef25db12d010d2823fdsfds423f3961968  

This would direct a non-IT user to the Portal.    

It is possible on mail scripts to check the user role, e.g.  if(gs.getUser().getUserByID(current.opened_by).hasRole('itil'))  And then generate a link to the SN tool for itil users, but for other users take them to a portal view.  

 

Problem:

The recipients of a single notification might have different roles, e.g.:

 

Joe Blogs - itil user

John Doe - non-itil user

 

Question: How would you generate a link in an email that would work for both user types and direct each to the right landing point?

 

- multiple notifs

- two links in email (one to portal one to to tool)

- mail script to email each recipient individually

- redirect

- other

 

1 ACCEPTED SOLUTION

So the group has the group email filled in and you send it to that? If the email address on the group is empty, it will send out an individual email to all group members. Then the script will work.

If you send out the email to the Group email address. Then only one email goes out and you should indeed set up redirect for the end users. You can refer to this:

Create the system property "glide.entry.loggedin.page_ess" if it does not already exist and set the value to "/sp". That should always redirect the ess users to your Service Portal.

https://hi.service-now.com/kb_view.do?sysparm_article=KB0714506

View solution in original post

13 REPLIES 13

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

So are you saying if you have 2 recipients for same email then it should be like this

1) User 1 - itil user - show link 1

2) User 2 - non-itil user - show link 2

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur

Yes.  But the issue is recipients can be both roled and non roled.  We've identified a couple of workarounds:

- define notification for each

- include both links in not-if

But I am hoping there is another solution using redirects, mail script, system parameter, .....

Thanks  

Palle
Tera Contributor

Hi Shone/Ankur

 

We had a similar requirement. Is there a solution or a way to achieve this?

Hi Palle, yes see Willem's solution above marked as correct answer.  Good luck