I want insert hyperlink of a catalog item in notification through mail script in Servicenow.How to proceed further on this

viraj4
Giga Contributor

I want insert hyperlink of a catalog item in notification through mail script in Servicenow.How to proceed further on this

1 ACCEPTED SOLUTION

Alberto Consonn
ServiceNow Employee
ServiceNow Employee

Hi,

create your Notification Mail Script with the following code (tested in my PDI, it works fine) and call it in your own Email Notification (example: put in message html text ${mail_script:sc_request_script_1}😞

var instance_url = gs.getProperty('glide.servlet.uri');
var url = instance_url+ 'com.glideapp.servicecatalog_cat_item_view.do?v=1&sysparm_id='+ '060f3afa3731300054b6a3549dbe5d3e'; // put your Catalog item sys_id here
template.print('<a href="'+url+'">Click here the Request</a><br />');

In case you need to open the Catalog Item of the Service Catalof in the SP portal, please use the following code:

var instance_url = gs.getProperty('glide.servlet.uri');
var url = instance_url+ 'sp?id=sc_cat_item&sys_id='+ '060f3afa3731300054b6a3549dbe5d3e'; // put your Catalog item sys_id here
template.print('<a href="'+url+'">Click here the Request</a><br />');

This the result in the Email Notification:

find_real_file.png

find_real_file.png

Result in the SP portal:

find_real_file.png

Let me if it works!

If I have answered your question, please mark my response as correct and/or helpful.

Thank you very much

Cheers
Alberto

View solution in original post

5 REPLIES 5

no need to create any property, I've just used this code in my OOTB PDI without creating any property, it's working fine, just give a try!