Add Link in the email script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2022 11:36 PM
Hello,
When ticket got closed, one survey notification will trgger to the user. Here new requirement is that, needs to add one Link in the email Notification. . when user click on that link that should redirected to survey quetions on the serviceportal page(find below page)
Thanks in advance

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2022 11:46 PM
Hello,
You can use this below for Surveys.. you can customize as per your requirement this below link.
template.print('<a href="https://' + gs.getProperty('instance_name') + '.service-now.com/nav_to.do?uri=incident.do?sys_id=' + gr.sys_id + '">' + gr.number + '</a>');
You have to do 2 things, first is the
1. Create a new email script:
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
// Add your code here
var url= <<your portal url>>;
template.print('<a href=' + url + '>Portal link </a' );
})(current, template, email, email_action, event);
2. Go to the notification HTML message, add
Lights...Camera...Action! ${mail_script:<<name of the script you created in step>>} is coming soon!
${mail_script:<<name of the script you created in step>>} - responsible to show the url in the mail
Let me know if it helps.
Thanks,
Vaishnavi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2022 12:07 AM
Hello,
To achieve this you need to do the below:-
Hello,
1. First create a new email script with below code:
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
var url= 'Add the Url of the Portal';
template.print('<a href=' + url + '>text you want to display in the mail </a' );
})(current, template, email, email_action, event);
Screenshot:-
2. Go to the notification HTML message and add the below
${mail_script:<name of the above email script>}
Screenshots:-
Please mark answer correct/helpful based on Impact