Email script is not working in notification for survey

ShardaP
Tera Contributor
 
5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

@ShardaP 

you didn't share any details around what's your issue, screenshot, script etc

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

ShardaP
Tera Contributor
(function runMailScript(current, template, email, email_action, event) {
    var asID = new GlideRecord('asmt_assessment_instance');
    asID.addQuery('task_id.number', current.number);
    asID.addQuery('metric_type', '300779211bca0654d0a0744ead4bcbcc');
    asID.query();
    if (asID.next()) {
        var link = "/assessment_take2.do?sysparm_assessable_type="+asID.metric_type+"&sysparm_assessable_sysid="+asID.sys_id;
        var url = '<a href="'+link+'">Take to me the survey</a>';
        template.print(url);

        //template.print('<a href="' + link + '">Take to me the survey</a>');

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

Viraj Hudlikar
Tera Sage

Hello @ShardaP  -

 

Can you share something like what is not working? What you have tried? What tech blocker are you facing so we folks can try to help you here.

If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.

 

Thanks & Regards
Viraj Hudlikar.

Hello @ShardaP 

Your code looks good to me. I believe your notification is on asmt_assessment_instance table like the OOTB one we have. Did you try to put log statements and try to preview the notification and check what is coming over logs is glide record happening as expected or not is record return after query?

 

If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.

 

Thanks & Regards

Viraj Hudlikar.