Link in the Email should redirect ITIL user to native UI page and non itil users to Service Portal

HariniGopi
Giga Contributor

Link in the Email should redirect ITIL user to native UI page and non itil users to Service Portal

5 REPLIES 5

the code in that post is not working for me, maybe the exact code might help

Ankur Bawiskar
Tera Patron

@HariniGopi 

what script did you try and what debugging you did?

(function runMailScript(current, template, email, email_action, event) {

    if (gs.getUserByID().hasRole('itil')) {
        template.print('Link: <a href="https://' + gs.getProperty('glide.servlet.uri') + '.service-now.com/incident.do?sys_id=' + gr.sys_id + '&sysparm_stack=incident_list.do?sysparm_query=active=true">click here</a>');
    } else {
        var url = '<a href="' + gs.getProperty('glide.servlet.uri') + 'sp?id=ticket&table=' + current.sys_class_name + '&sys_id=' + current.sys_id + '">Link</a>';
        template.print(url);
    }

})(current, template, email, email_action, event);