How to send notification to user id of reference field?

SHAIK MAHABOOB2
Tera Contributor

Hi,

 

I want to send a notification with below conditions. Trying with event and notification and BR. But notification is not triggering correctly.

On Analysis table have a reference field(matrix_id) it is reference to the table Expirement and matches with reference field (pcp) from that table sys id is matching with plan table sysid need to send notification to user id field in plan table.

Here is my Script for BR

 

Writing BR on Analysis table.

 

var matID = current.getvalue('matrix_id');

    var expGR = new GlideRecord('x_snc_nsl_tracker_split_matrix');
    expGR.addQuery('pcp', matID);
    expGR.query();

    while (expGR.next()) {

        var planGR = new GlideRecord('x_snc_nsl_tracker_plan_team');
        planGR.addQuery('plan_id', expGR);
        //planGR.addQuery('sys_id', expGR);
        planGR.query();

        //while (planGR.next()) {
            var userId = planGR.getValue('user_id');
            //sendNotification(userId);
            gs.eventQueue("x_snc_nsl_tracker.experiment.analysis", current, userId);
        //}
 
NOTE: Kindly help me where i am doing wrong

 

3 REPLIES 3

Peter Bodelier
Giga Sage

Hi @SHAIK MAHABOOB2,

 

In the first line of your script getValue needs to be a capitol V.

 

You probably commented some line during testing. but, this prevents your planGR query to move to the first record. So add planGR.next() or uncomment the last while.


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

Ankur Bawiskar
Tera Patron
Tera Patron

@SHAIK MAHABOOB2 

So what debugging did you do from your side?

I hope event, notification and BR are on same table

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

Hi Ankur,

I have mentioned some logs in code but it is coming undefined in logs.

Event, notification and BR are on same table.