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

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

-Andrew-
Kilo Sage

Try this:

link = gs.getProperty("glide.servlet.uri") + portal_gr.getValue("url_suffix");

template.print('<a href="' + link + '"');

template.print(gs.getMessage('Click here for portal.'));

template.print('</a>');

 

then

 

RudhraKAM
Tera Guru

Thanks all 🙂 

RudhraKAM
Tera Guru

Can you also please let me know how to get to a request in portal ?

example , when i get this notification up on clicking the link it should redirect me to the record where the notification is generated from (in portal view)