Create an dynamic URL in notifications

is_12
Tera Contributor

In the notification, if an agent clicks on URL it should be redirected to case form of the requested catalogue item.

1 ACCEPTED SOLUTION

Community Alums
Not applicable

Hi @is_12 ,

I tried your problem in my PDI and it works for me please refer below steps 

Create email script and add below code 

(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
    /* Optional EmailOutbound */
    email, /* Optional GlideRecord */ email_action,
    /* Optional GlideRecord */
    event) {

    // Add your code here
	var instanceName = gs.getProperty('instance_name');
	var url = "https://"+instanceName+".service-now.com/incident.do?sys_id=" + current.sys_id;
	template.print('<a href=' + url + '&target=_blank"> Click Here </a>');

})(current, template, email, email_action, event);

 

SarthakKashyap_0-1717263945993.png

 

Result 

 

SarthakKashyap_2-1717263987435.png

SarthakKashyap_3-1717264006466.png

 

Please mark my answer correct and helpful if this works for you

Thanks and Regards

Sarthak

View solution in original post

3 REPLIES 3

Community Alums
Not applicable

Amitoj Wadhera
Kilo Sage

Hi @is_12 ,

 

You can create an email script, here is an example:

 

(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
          /* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
          /* Optional GlideRecord */ event) {

	template.print('<a href="URL_TO_BE_REDIRECTED"  target="_blank">' + Click Here + '</a>');

})(current, template, email, email_action, event);

 

 

If you find my response helpful, please consider marking it as the 'Accepted Solution' and giving it a 'Helpful' rating. Your feedback not only supports the community but also encourages me to continue providing valuable assistance.

 

Thanks,

Amitoj Wadhera

Community Alums
Not applicable

Hi @is_12 ,

I tried your problem in my PDI and it works for me please refer below steps 

Create email script and add below code 

(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
    /* Optional EmailOutbound */
    email, /* Optional GlideRecord */ email_action,
    /* Optional GlideRecord */
    event) {

    // Add your code here
	var instanceName = gs.getProperty('instance_name');
	var url = "https://"+instanceName+".service-now.com/incident.do?sys_id=" + current.sys_id;
	template.print('<a href=' + url + '&target=_blank"> Click Here </a>');

})(current, template, email, email_action, event);

 

SarthakKashyap_0-1717263945993.png

 

Result 

 

SarthakKashyap_2-1717263987435.png

SarthakKashyap_3-1717264006466.png

 

Please mark my answer correct and helpful if this works for you

Thanks and Regards

Sarthak