Change Task notification to contain link to Change Request
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2015 10:37 PM
Hi
I'm trying to add the Change Request link to the change_task.itil.role email template so that the recipient of the assigned Change Task is able to click on the Change Task notification link and open the Change Request directly from the email. At present I've created a Notification Email Script (below) that is successful in generating the link except as it iterates through the script it prints every Change Request number instead of just the same one as the Change Request it came from. Does anyone know how to hone it to only show the parent change request as a link?
***************************************************************************************
ctaskLinks();
function ctaskLinks() {
//Check for any tasks and add links if they exist
var gr = new GlideRecord('change_request');
//gr.addQuery('change_task', current.sys_id); - created email with all Change Request numbers
//gr.addQuery('change_task', current.change_task.change_request.sys_id); - as above
//gr.addQuery('change_task', current.change_request.sys_id); - as above
gr.addQuery('change_task', current.change_task.sys_id);
gr.query();
if(gr.hasNext()){
template.print('Change Request: \n');
while (gr.next()) {
var link = createLinkForTask(gr.getTableName(), gr.sys_id, gr.number);
template.print(link + '\n');
}
template.print('<hr/>');
}
}
function createLinkForTask(strTableName, strSysID, strTaskNumber) {
return "<a href=\"" + gs.getProperty("glide.servlet.uri") + gs.generateURL(strTableName, strSysID) + "\">" + strTaskNumber + "</a>";
}
***************************************************************************************

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2015 10:56 PM
Hi Christine,
Please check section 8.2 for more info.
http://wiki.servicenow.com/index.php?title=Email_Notifications#gsc.tab=0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2015 01:12 AM
Click here to view Related Change: ${change_request.URI_REF}
---------------
that's all you should need to do if you want to link to the parent change.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2015 10:53 PM
Thank you kindly Pradeep, I'd tried all sorts of variations but not that one!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2021 09:59 AM
This worked perfect for me! Thank you!