Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Mail Script Not Showing URL in Notification

Wasdom_Kung
Tera Guru

Hello,

I have the following mail script, I have also tried adding it to an existing one and had the same result:

Mailscript: loth_survey_results

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

    var resultsURL = 'REDACTEDURL.com';
    template.print('<a href=' + resultsURL + "View results from recent Digital&IT Surveys" + '</a>');

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

The URL and text does not appear in the preview or when a notification is received for completing a survey.

Placement of mailscript in existing and working notification:

Wasdom_Kung_0-1702634584789.png

Can anyone see why this wouldn't be working? 

 

Thank you.

1 ACCEPTED SOLUTION

Tai Vu
Kilo Patron
Kilo Patron

Hi @Wasdom_Kung 

It appears missing the '>'. Let's try the below adjustment.

 

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

    var resultsURL = 'REDACTEDURL.com';
    template.print('<a href=' + resultsURL + '>' + "View results from recent Digital&IT Surveys" + '</a>');

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

 

 

Cheers,

Tai Vu

View solution in original post

3 REPLIES 3

Tai Vu
Kilo Patron
Kilo Patron

Hi @Wasdom_Kung 

It appears missing the '>'. Let's try the below adjustment.

 

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

    var resultsURL = 'REDACTEDURL.com';
    template.print('<a href=' + resultsURL + '>' + "View results from recent Digital&IT Surveys" + '</a>');

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

 

 

Cheers,

Tai Vu

Ah, always something simple, thank you Timi 🙂

@Wasdom_Kung haha you're so welcome. Sometimes we may need a second pair of eyes. 😜

 

Cheers,

Tai Vu