Ho w to Field details and URL in Email notification

jugantanayak
Tera Guru

Hi,

Anyone can please help me on, how I can add Integration field details in the watchdog notification and URL(view) for that particular record.

Screenshots attached to this post.

Table : sn_vul_integration_run

Field: Integration

I have written one email script but it seems it's not working.

Script:

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

    var count = event.parm1;
    var log = event.parm2;
    var body = gs.getMessage("You are receiving this email because you are subscribed to the watchdog alert: {0}.<br/><br/> The WatchDog alert rule currently generates {1} alerts.<br/><br/>Note that system automatically runs watchdog alert {2} based on current scheduler interval.", [current.name, count, current.name]);
    template.print(body);
    var recordURL = gs.getProperty('glide.servlet.uri') + "/sn_sec_cmn_watch_log.do?sys_id=" + log;
    template.print('<a class="button" href="' + recordURL + '">View</a>');

})(current, template, email, email_action, event);
 
jugantanayak_0-1705602031937.png

 

jugantanayak_0-1705649758966.png

 


 


Thanks in advance.

 

Regards,

Juganta

5 REPLIES 5

Subhashis Ratna
Tera Guru

Hi @jugantanayak ,

Could you use this modified line in your mail script.


Create a system property named 'instance_name' and store your company's domain ID in this system property. I guess you already have this system property in your company instance.

template.print('<a href="https://' + gs.getProperty('instance_name') + '.service-now.com/nav_to.do?uri=sn_vul_integration_run.do?sys_id=' + log + '"');

 

Please mark this comment as Correct Answer/Helpful if it helped you.

Regards,

Subhashis