The CreatorCon Call for Content is officially open! Get started here.

Need help on mail script to link the ticket to Workspace instead of legacy view

Bird1
Mega Sage

Hello

I am working on mail script. I found the  ${URI_REF}  will link the ticket to legacy view only but we would like to promote more usage to Workspace, so we need to create the mail script that will show the ticket number and after we click the link it will go to the Workspace instead.

 

Sample

Now when click the ticket link which is from ${URI_REF}, it will go to

https://abc.service-now.com/nav_to.do?uri=%2Fx_alite_us_treas_0_us_treasury_request.do%3Fsys_id%3D2c1ce2f187c99550a62420e5cebb35a6%26sysparm_stack%3Dx_alite_us_treas_0_us_treasury_request_list.do%3Fsysparm_query%3Dactive%3Dtrue

 

but I need it to re-direct to

https://abc.service-now.com/x/alite/treasury/record/x_alite_us_treas_0_us_treasury_request/2c1ce2f187c99550a62420e5cebb35a6

1 ACCEPTED SOLUTION

@Bird i got this working some how can you try this?

var agentURL = '<a href="' + gs.getProperty('glide.servlet.uri') + '/x/alite/treasury/record/'+ current.getTableName() + '/' + current.sys_id + '">' + 'Click Here'+ '</a>';
  template.print(agentURL + "<br />");

Mark this correct if it helps you

View solution in original post

10 REPLIES 10

Mohith Devatte
Tera Sage
Tera Sage

 hello @Bird 

you can write you email script like this 

var link= '<a href="https://abc.service-now.com/x/alite/treasury/record/x_alite_us_treas_0_us_treasury_request/"'+current.sys_id+'>'+'click here'+'</a>'
template.print(link);


and call your email script in notification like below 

${mail_script:your_mail_script_name}

please mark my answer correct if it helps you

 

HI Mohith

 

I tried but it doesn't get the sysid.

 

Here's the result after click on the link

https://abc.service-now.com/x/alite/treasury/record/x_alite_us_treas_0_us_treasury_request/

 

but we should get this result instead: https://abc.service-now.com/x/alite/treasury/record/x_alite_us_treas_0_us_treasury_request/2c1ce2f187c99550a62420e5cebb35a6

this is script

 

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

var link = '<a href="https://abc.service-now.com/x/alite/treasury/record/x_alite_us_treas_0_us_treasury_request/"'+current.sys_id+'>'+'click here'+'</a>';
template.print(link);

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

hello @Bird ,

which table is the notification configured on ?

i am assuming its on x_alite_us_treas_0_us_treasury_request this table ?