email mail script to direct users to Portal/Instance depending if have role

MrGrump
Tera Contributor

Hi 

I'm attempting to put together a mail script for a request notification which directs the user either to the Service Portal if they have no role and if they have an itil role directs the user to my tickets

I've started putting together the following but not sure how to direct ITIL users to the My Tickets view i have created 

 

var requestURL = gs.getProperty('glide.servlet.uri') + "nav_to.do?uri=sc_req_item.do?sys_id=" + current.sys_id;
    var portalUrl = "https://" + instance + ".service-now.com/";
    if (gs.hasRole('itil')) {
        requestURL = '';
        template.print(portalUrl);
    } else {
       template.print("<a href=\"" + portalUrl + "\">My Tickets</a>");
		//template.print("<a style='color: #0000FF;' href='" + requestURL + "' title='My Portal'>My Portal</a>");
    }
    
4 REPLIES 4

Harish KM
Kilo Patron
Kilo Patron

Hi what is MY tickets here? is this widget on Portal?

Regards
Harish

HI @Harish KM 

I have setup a view under the standard fulfiller view of the Self Service Application Navigator. This may not be the best way but is only for ITIL users who have access to ServiceNow, other users can view there tickets through the SP

suvro
Mega Sage
Mega Sage

My tickets is portal page ?

 

Then try this

 

var requestURL = gs.getProperty('glide.servlet.uri') + "nav_to.do?uri=sc_req_item.do?sys_id=" + current.sys_id;
    var portalUrl = "https://" + instance + ".service-now.com/sp";
    if (!gs.hasRole('itil')) {
        requestURL = '';
        template.print(portalUrl);
    } else {
       template.print("<a href=\"" + portalUrl + "\id=my_ticket">My Tickets</a>");
		//template.print("<a style='color: #0000FF;' href='" + requestURL + "' title='My Portal'>My Portal</a>");
    }

suvro
Mega Sage
Mega Sage

In the request URL you can add

sysparm_view=my_tickets

 

gs.getProperty('glide.servlet.uri') + "nav_to.do?uri=sc_req_item.do?sys_id=" + current.sys_id+"&sysparm_view=my_tickets";