Email notification with link to tickets

prithatcs
Tera Contributor

Hi everyone,

 

We have a requirement where we place request to retire a specific group. A request is generated and approval is sent to group manager.

Before retiring the group, the manager should see if any ticket is assigned to group, and then approve or reject.

Through normal email notification iam not able to get a link to the tickets.

Any idea on how to achieve this ?

2 ACCEPTED SOLUTIONS

Sagar Pagar
Tera Patron

Hi @prithatcs,

Take a look at nice article. It will be helpful for you.

Email links using ${URI} and ${URI_REF} 

Notifications using ${URI_REF} are displaying "LINK" in place of actual ticket numbers. 

 

Thanks,
Sagar Pagar

The world works with ServiceNow

View solution in original post

SatyakiBose
Mega Sage

Hello @prithatcs 

Here is a script that you can use in your notification scripts.

(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
          /* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
          /* Optional GlideRecord */ event) {
var sid = current.variables.select_group;
var url = gs.getProperty('glide.servlet.uri') + 'incident_list.do?sysparm_query=active=true^assignment_group=' + sid;
template.print(url + "<br />");

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

For var sid, you need to change it with the variable that you have in the request.

This is just for incident. You need to tweak it for additional tables in your system.

 

If this solved your question, please mark it as solution.

View solution in original post

3 REPLIES 3

Sagar Pagar
Tera Patron

Hi @prithatcs,

Take a look at nice article. It will be helpful for you.

Email links using ${URI} and ${URI_REF} 

Notifications using ${URI_REF} are displaying "LINK" in place of actual ticket numbers. 

 

Thanks,
Sagar Pagar

The world works with ServiceNow

Not exactly this.

My requirement is that when the manager gets the email, he should get a link with all the tickets assigned for the group.

SatyakiBose
Mega Sage

Hello @prithatcs 

Here is a script that you can use in your notification scripts.

(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
          /* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
          /* Optional GlideRecord */ event) {
var sid = current.variables.select_group;
var url = gs.getProperty('glide.servlet.uri') + 'incident_list.do?sysparm_query=active=true^assignment_group=' + sid;
template.print(url + "<br />");

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

For var sid, you need to change it with the variable that you have in the request.

This is just for incident. You need to tweak it for additional tables in your system.

 

If this solved your question, please mark it as solution.