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

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

Hi Alberto,

Before i proceed just wanted to confirm will this work for Service Portal and secondly i am using Kingston.So will this work as expected.

Regards,

Viraj

Hi Viraj,

as you can see I've tested it using the hyperlink for backend and service portal, so both are working fine, also in Kingston, no problem.

Let me know if you will make it work!

Please remember to mark my response as correct and/or helpful.

One more question I have that is do I need to create the property as i can't find the one you have mentioned out of the box.

Regards

Viraj