- 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:21 AM
Hi Ankur,
I am close to achive this and i can able to redirect corresponding record.But the strange thing in body it's displaying like below
click here to visit current.number
Instead of that i want display only number with hyperlink similar to current.number like below
LAP432567
Can you please help how to achive this
Thanks,
Ramesh Kalava
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2020 05:27 AM
Hi,
please update as below
(function runMailScript(current, template, email, email_action, event) {
// Add your code here
template.print('<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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2020 05:32 AM
Still i am getting current.number.
I want display the ticket number ankur not current.number for example
if we take incident INC123456 - so if i click this it will take to this record.So my notification body should display
INC123456
In our scenario all the scenarios working in body instead of ticket number it's displaying current.number
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2020 05:50 AM
Hi,
The script should give number using proper field; which is the field on your table which holds the number; also the notification is on which table
This should work fine; just check once
(function runMailScript(current, template, email, email_action, event) {
// Add your code here
var url = '<a href="' + gs.getProperty('glide.servlet.uri') + '/nav_to.do?uri=' + current.getTableName() + '.do?sys_id=' + current.sys_id + '">' + current.getDisplayValue() + '</a>';
template.print(url);
})(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 06:52 AM
Thanks Ankur, I have given correct field name and it's not working tried above code also and it's not displaying number in body.