[Notifications] How to create notifications/reminder to users with a specific role?

John Clyde Ap_a
Giga Expert

Hello, how can I create a notification/reminder to users with a specific role? Can someone please guide me on how to set it up?

My main requirement is just to create a notification/reminder to each manager to check and update the drinks table. 

There are no other prerequisites for it, its just to notify the manager every week or so.

 

How can I achieve this?

1 ACCEPTED SOLUTION

Mohith Devatte
Tera Sage
Tera Sage

Hello @John Clyde Ap[as ,

you can do it like this if its a weekly process 

1) Create a event in event register table 

find_real_file.png

2)Create a scheduled job where you can call your event and set your scheduled job to run weekly once at your required time with this script of your requirement and trigger the event 

var gr= new GlideRecord('your_drink_table');
gr.addQuery('<fieldname>','<value>'); //. add your query 
gr.query();
if(gr.next())
    {
        gs.eventQueue('your_event_name',gr,'','');
    }

find_real_file.png

 

3)Then use this event in the notification and in whom to send select your manager as the recepient

find_real_file.png

PLEASE MAK MY ANSWER CORRECT IF IT HELPS YOU

View solution in original post

21 REPLIES 21

@John Clyde Ap[as so three rules we need to remember is 

1) Create an event on your drinks table 

2)Create your notification also on drinks table 

3) While calling the event you need to pass your glide record object where you did glide record of drinks table 

all three should be on same table 

Now why we need to do glide record is nothing but you need to pick up records for which you need to send the notification for lets say you have to notify your manager for the records which are not updated from last seven days 

you can do a glide record like below

var gr= new GlideRecord('your_drink_table');
gr.addEncodedQuery('sys_updated_onNOTONLast 7 days@javascript:gs.beginningOfLast7Days()@javascript:gs.endOfLast7Days()'); //. add your query 
gr.query();
While(gr.next())
    {
        gs.eventQueue('your_event_name',gr,'','');
    }

like this you need to add your query to pick up records and the i used gr as the glide record object so glide record object needs to be passed as the parameter for the event which is the syntax to call an event

Hope this is understandable

 

Hello Mohith, 

Thank you for your patience, I am learning a lot. Just a couple more things.

 

First things first, just for confirmation, here are all the configs:

Event registry info:

find_real_file.png

Scheduled job script:

find_real_file.pngfind_real_file.png

 

Notification:

find_real_file.png

find_real_file.png

 

I have set up the things you have mentioned. How may I test this out to see if it works in simulation by impersonating the user with the role?

 

Thank you

 

~Mel

 

 

@John Clyde Ap[as CHANGE THE EVENT NAME IN YOUR NOTIFICATION  IN EVENT FIELD AND REST EVERY THING IS FINE 

Also for testing go to your scheduled job and on the top right corner you can see Execute now button click on it and you will see the result in emails table 

find_real_file.png

Hello Mohith,

Here it is now.

find_real_file.png

 

I have confirmed that is it indeed there now. 

find_real_file.png

 

Just a follow up question. When I impersonate as the user with manager role. Is the notification supposed to be shown here?

find_real_file.png

May I ask why is it not displaying? or is supposed to be displayed here?

@John Clyde Ap[as ONLY ADMINS CAN SEE THE EMAIL LOGS

WHEN IT GOES TO YOUR PRODUCTION INSTANCE EMAIL SENDING WILL BE ENABLED AND AUTOMATICALLY IT WILL SHOOT THE EMAIL TO THE GROUP MEMBERS IN OUTLOOK.

But to test it you need to do with admin only 

PLEASE MARK MY ANSWER CORRECT IF IT HELPS YOU