- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2018 02:13 AM
Hi All,
I have a scheduled job checking my incident table for tickets that have been in progress for longer than 4 days, i'm passing an array of the resulting sys_id's through to a notification as parm2 and then looping through them to populate the notification with a series of links to each incident.
The trouble is, if there are a lot of records, the notification gets a bit long. A better solution would be to send out a link to a list of tickets so that recipients can just click on that and view the subset.
Is it possible to dynamically build a link to a list using something like an encoded query string? If so, how do you do it?!
Cheers
Dave
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2018 05:12 AM
yes that is possible.
var ids = 'sys_id1,sys_id2_sys_id3,sys_id4' ; //comma separated list of sys_ids (String)
var link = '<a href="incident_list.do?sysparm_query=sys_idIN'+ids+'" >Incident List</a>';
template.print(link);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2018 02:29 AM
Hi David,
Yes we can pass the link in the event parm2 and then append the link using the email template. For suppose if you get the results as below in your scheduled job:
inc_numbers = "INC000001,INC000002,INC000003,INC000004";
pass the above value in the event parm 2 and below is the email script:
Email Script:
var num = event.parm2;
var url = '<a href="' + gs.getProperty('glide.servlet.uri') + 'incident_list.do?sysparm_query=numberIN' + num + '">List of Incidents</a>';
template.print(url);
Call the Email script from notification.
Regards,
Ram M
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2018 04:48 AM
Hello David,
Build a URL for your incident table with an encoded query like below and send it using notification.
URL: https://<instance name>.service-now.com/incident_list.do?sysparam_query=<paste your encoded query>.
Hit Like or Correct on the impact of response.
-Tushar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2018 05:12 AM
yes that is possible.
var ids = 'sys_id1,sys_id2_sys_id3,sys_id4' ; //comma separated list of sys_ids (String)
var link = '<a href="incident_list.do?sysparm_query=sys_idIN'+ids+'" >Incident List</a>';
template.print(link);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2018 05:50 AM
Perfect, thanks Gurpreet, works perfectly.