- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2020 04:12 AM
Hello Community,
Can any one help below requirement.
I want to display the number in notification body through email script and if i click that number it should be open form view same record and i dont want to open in service portal.
anyone help me with the script it's highly appreciated.
Thanks,
Ramesh kalava
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2020 05:22 AM
Hi
In your script you can do simply like this
var attachLink = '<a href="/incident.do?sys_id='+current.sys_id+'">' + current.number + '</a>'; //put your table name
template.print(attachLink);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2020 05:15 AM
It's displaying the all the details which we stored in variables in body.i am not getting the number to click
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2020 09:05 AM
Hi,
Please try below
var instance_name = gs.getProperty('instance_name');
var table= current.getTableName();
var url = "https://"+instance_name+".service-now.com/nav_to.do?uri="+table+".do?sys_id="+current.sys_id;
var TcktNum = current.number ;
var TcktUrl = "<a href="+url+">"+TcktNum+"</a>";
template.print(TcktUrl);
If I have answered your question, please mark my response as correct and/or helpful.
Thanks,
Suseela P.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2020 04:23 AM
Hi,
the link should be something like this
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
template.print('Click here to visit <a href="https://give urs instance url here/nav_to.do?uri=incident.do?sys_id=' + current.sys_id + '"> current.number </a>');
})(current, template, email, email_action, event);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2020 04:46 AM
Above URL is not working and getting syntax error ankur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2020 05:10 AM
Hi,
please try this
ensure you give valid table name etc
(function runMailScript(current, template, email, email_action, event) {
// Add your code here
template.print('Click here to visit <a href="/nav_to.do?uri=incident.do?sys_id=' + current.sys_id + '"> current.number </a>');
})(current, template, email, email_action, event);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader