- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
3 weeks ago - last edited 3 weeks ago
The recipient of the email notification include Requested_for, Watchlist and Opened_by users(multiple recipient for single email). based on the user roles the link in the email should redirect either to SP or to Native UI page. How to achieve this?
Solved! Go to Solution.
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
3 weeks ago
check this
Dynamic email links dependent on recipient role?
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
3 weeks ago
Hi @Yakshitha,
Use a Mail Script in your notification to generate a role-based link dynamically:
(function runMailScript(current, user, email, email_action, event) {
    var baseURL = gs.getProperty('glide.servlet.uri');
    var link = '';
    if (user.hasRole('itil') || user.hasRole('admin')) {
        link = baseURL + 'nav_to.do?uri=' + current.getTableName() + '.do?sys_id=' + current.sys_id;
    } else {
        var spPortal = gs.getProperty('glide.service_portal.default_portal', 'sp');
        link = baseURL + spPortal + '?id=' + current.getTableName() + '&sys_id=' + current.sys_id;
    }
    template.print('<a href="' + link + '">View ' + current.getDisplayValue() + '</a>');
})(current, user, email, email_action, event);
					
				
			
			
				
			
			
				
			
			
			
			
			
			
		- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
3 weeks ago
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
3 weeks ago
@Yakshitha Did this answer your query?
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
3 weeks ago
check this
Dynamic email links dependent on recipient role?
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
