Notification not working

sunil maddheshi
Tera Guru

Hey Everyone,

 

I am trying to trigger a notification through background script using event, but email is not triggering, when i checked the event log i can see event has triggered but not sure why it is in ready state every time when i try to trigger. Please see the screenshot. ThankseventStuckinReadyState.png 

11 REPLIES 11

shibasou
Kilo Sage

Hi.

Take a look at the "email_diagnostics" table.

I don't think PDI offers the ability to send emails.

 

Mark Helpful if you accept the solution.

Thank you.

 

Ankur Bawiskar
Tera Patron
Tera Patron

@sunil maddheshi 

I couldn't see any recipient in event table

Are you sure recipient is set correctly?

Is this for your customer instance or PDI?

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

Hi @Ankur Bawiskar 

This is customer instance, and I am trying to send a notification to a user with the list of custom fields which has no value in all records, I am testing the notification using background script before putting in schedule job. Below are the background script and screenshots of notification.

var tableName = ['sn_grc_issue', 'sn_grc_task', 'sn_audit_engagement'];
 for (var i = 0; i < tableName.length; i++) {
     var fieldArr = [];
     var dictionaryGR = new GlideRecord('sys_dictionary');
     dictionaryGR.addEncodedQuery('elementSTARTSWITHu_^active=true^name=' + tableName[i]);
     dictionaryGR.query();
     gs.info(dictionaryGR.getRowCount());
     while (dictionaryGR.next()) {
         checkUnusedField(tableName[i], dictionaryGR.element, dictionaryGR.column_label);
     }
     gs.info("Un-used fields on table " + tableName[i] + " are " + fieldArr);
     if (fieldArr.length > 0) {
        gs.info("inside if");
         gs.eventQueue('unused_field_event', dictionaryGR, tableName[i], fieldArr);
     }
 }

 function checkUnusedField(table, field_name, field_label) {
     var tableGr = new GlideRecord(table);
     tableGr.addEncodedQuery('' + field_name + '!=NULL');
     tableGr.query();
     if (tableGr.getRowCount() == 0) {  //field has empty value in all records
         fieldArr.push(field_label + " ");
     }

 }

notification_sc.pngNotif_reciepient.pngNotif_body.pngmailscript.png

@sunil maddheshi 

did the event get processed?

Did it trigger email log record and did you check that user has email populated and is active and not locked out and has notification preference enabled on profile?

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