Mail script to display a link

RudhraKAM
Tera Guru

Hello , we have a requirement in a notification, we need to provide the link to portal ( this need to be done via mail script , as there are multiple notifications ) 

The notification is in scoped application , Mail script is also in scoped application , for some reason I am not able to see the link in the notification. what am i doing wrong here ?

code in Notification 

 

${mail_script:redirect_user_to_portal}

 

Mail script code :  where "eam" is the portal name , the notification is triggering but the mail script is not displaying, I validated the name too

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

    // Add your code here
   var url = '<a href="' + gs.getProperty('glide.servlet.uri') + 'eam' +'">Click here for portal.</a>';


})(current, template, email, email_action, event);
1 ACCEPTED SOLUTION

Anurag Tripathi
Mega Patron
Mega Patron

Hi,

Use this

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

    // Add your code here
   var url = '<a href="' + gs.getProperty('glide.servlet.uri') + 'eam' +'">Click here for portal.</a>';

template.print(url);
})(current, template, email, email_action, event);
-Anurag

View solution in original post

5 REPLIES 5

ZODE
Tera Contributor

Hi Anurag,

 

I have a requirement for a catalog item question variable which has 4 options (Multichoice).

Option 1 - Report A

Option 2 - Report B

Option 3 - Report C

Option 4 - Report D

 

So when any one of these options is selected and submitted, RITM gets generated and is sent for approval. Once Approved by the approval group, the notification should be triggered to the user which will have the access to that report via a link (Click here to access your report). So each option has different links. How do I write a mail script for this requirement? Do you have any sample code ? Because not sure if we can use variables in a mail script.

 

Thanks in advance!