How to add URL in email script to use it in Notification

anilkumarsharma
Giga Guru

@ankurt 

@Ankur Bawiskar 

Dear All,

I'm trying to use below mention link in  (var url1 = '<a href="' + gs.getProperty('instance_name')+'.service-now.com/'+'url' +'">Link</a>';) but it is not working in notification.

please let me know where I'm doing mistake.

 

 

var url='sn_grc_issue_list.do?sysparm_userpref_module=1c6662b30f1812004e938fbce1050999&sysparm_query=active%3Dtrue%5Eitem.sys_class_name%3Dsn_compliance_control%5EORitemISEMPTY%5Eassigned_toDYNAMIC90d1921e5f510100a9ad2572f2b477fe%5EORassigned_toDYNAMIC0f63961e5f510100a9ad2572f2b479998%5EORassignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744%5EORitem.ownerDYNAMIC90d1921e5f510100a9ad2572f2b47776e%5Esys_class_name%21%3Dsn_vdr_risk_asmt_issue%5EEQ';

 


template.print(url1);

1 ACCEPTED SOLUTION

Tony Chatfield1
Kilo Patron

Hi, when you state 'it is not working' what is your actual diagnosis?
Have you created this as a notification email script and called it from your notification?
What is populated into the body of your sent email, do you see the word 'Link' ?

 - you must enable email sending as notification email scripts run when a message is sent, not when the message is populated into the outbox.


Assuming you see the 'Link' in your notification, what is wrong with the actual redirect\url?
Looking at your code you have 'url' in quotes meaning that it is a string, not a reference to your string named url, perhaps try

var url1 = '<a href="' + gs.getProperty('instance_name')+ '.service-now.com/' + url + '">Link</a>';

 

Notification Email Scripts | ServiceNow Developers

Scripting for email notifications (servicenow.com)

 

 

 

View solution in original post

1 REPLY 1

Tony Chatfield1
Kilo Patron

Hi, when you state 'it is not working' what is your actual diagnosis?
Have you created this as a notification email script and called it from your notification?
What is populated into the body of your sent email, do you see the word 'Link' ?

 - you must enable email sending as notification email scripts run when a message is sent, not when the message is populated into the outbox.


Assuming you see the 'Link' in your notification, what is wrong with the actual redirect\url?
Looking at your code you have 'url' in quotes meaning that it is a string, not a reference to your string named url, perhaps try

var url1 = '<a href="' + gs.getProperty('instance_name')+ '.service-now.com/' + url + '">Link</a>';

 

Notification Email Scripts | ServiceNow Developers

Scripting for email notifications (servicenow.com)