Add Link in the email script

n_16
Tera Contributor

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)

find_real_file.png

Thanks in advance

 

2 REPLIES 2

Vaishnavi Lathk
Mega Sage
Mega Sage

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

Saurav11
Kilo Patron
Kilo Patron

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:-

find_real_file.png


2. Go to the notification HTML message and add the below

${mail_script:<name of the above email script>}

Screenshots:-

find_real_file.png

 

Please mark answer correct/helpful based on Impact