Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How I can automate sending CAB invitation by system itself every week

Priyanka Sadhw1
Kilo Expert

What I thought was job should run every week and send mail.

There are 2 UI action which should run 

find_real_file.png

I am looking for script in Job which can hit/click these 2 links 

May be 2 different job which pick CAB meeting record for current week and click 2 links

1)Refresh Agenda items- once we click on this , decision box like this come lets say if I press No every timefind_real_file.png

 

2)Send meeting request to attendees- next when this link is clicked- Another decision box- where I say send all.

find_real_file.png

 

1 ACCEPTED SOLUTION

@Priyanka Sadhwani one thing I noticed is that you should wrap your line 6,7 inside While loop so that it trigger notifications for all the cab meetings retrieved as part of our query. 

while(gr.next()){
 var notifiedAttendeesCount = .....................;
 ..................

}
Regards,
Muhammad

View solution in original post

17 REPLIES 17

sn_change_cab_notify_all_attendees is action name being used in Notify All Attendees Ui action and which is getting called from Send meeting request to attendees via that action name. Events are getting triggered by Notify All Attendees UI action. See screenshot below.

find_real_file.png

find_real_file.png 

Above Ui action is calling CABMeeting() script include and that script include calling another script include. 

I would recommend not to go that deep into the script as you are not very into scripting so will be lost. 

If you know how to script a scheduled job, just wrap two server side functions I explained in the first UI action into the Script include and call from the job with minor tweaks. It will do the job. 

Please mark this accepted & helpful, if it helps.

 

Thanks & Regards,

Sharjeel

 

Regards,
Muhammad

Actually Job I was trying since your first reply

See- after if  section- not able to understand what is happening

find_real_file.png

CABMeeting script include is in scoped app so you have to give fully qualified name domain + script include name.

sn_change_cab.CABMeeting(gr)

 

Also, here is the sample code I just ran for quick testing in the background script and its working fine. 

var gr = new GlideRecord('cab_meeting');
gr.addQuery('sys_id', <sys_id>); // replace sys_id with any Cab meeting sys id.
gr.query();
gr.next();
gs.print(gr.getRowCount());

var notifiedAttendeesCount = new sn_change_cab.CABMeeting(gr).createCABAttendeeNotifyEvents();
var infoMessage = notifiedAttendeesCount > 0 ? gs.getMessage("Notifications sent to all attendees") : gs.getMessage("No notifications sent as there are no attendees");
gs.print(infoMessage);

 

Replace <sys_id> with one of your Cab meeting sys ID in the above code and test in background script and see the output for reference. after that you can modify this as per your need

Let me know if you face any issues.

 

Please mark this accepted & helpful, if it helps.

 

Thanks & Regards,

Sharjeel

Regards,
Muhammad

Hi Sharjeel,

It is working by hardcoded sysid.Now I need to fetch meeting sys_id weekly- may be in encoded query, which is not happening

find_real_file.png

It is wrking now after removing @
find_real_file.png