Automate CAB invite to ALL

Dale Donahue
Tera Contributor

Hi All,

 

I found this post which was super helpful for automating the CAB meeting creation and invites to attendees.

https://www.servicenow.com/community/now-platform-articles/simple-automation-of-cab-meeting-creation...

 

But what it is lacking is, it does not invite the board members. So what I would like to have done, is the agenda gets refreshed and after that send an invite to ALL attendees and board members.

 

var now = new GlideDateTime();
var myCabDefinition = 'your_cab_definition_sys_id';

//First we create the new cab meeting by getting our cab definition record.
//The definitions schedule will decide if a meeting should be created, make sure your repeat until date is a day or 2 after your first cab date
var myCabParent = new GlideRecord('cab_definition');
myCabParent.get(myCabDefinition);

new sn_change_cab.CABDefinition(myCabParent).refreshMeetings();

//Now we find the meeting that has just been created
var myNewMeeting = new GlideRecord('cab_meeting');
myNewMeeting.addActiveQuery();
myNewMeeting.addQuery('cab_definition', myCabDefinition);
myNewMeeting.orderByDesc('sys_created_on');
myNewMeeting.setLimit(1);
myNewMeeting.query();

//Then populate the meeting agenda and send the invites
if (myNewMeeting.next()) {
    var cabMeeting = new sn_change_cab.CABMeeting(myNewMeeting);
    cabMeeting.refreshChangeAgendaItems();
    cabMeeting.createCABAttendeeNotifyEvents(now);
}

//Finally we increment the definition schedule 'repeat until' by 7 days
//We do this weekly so that if the CAB definition is changed there is no remedial action necessary.
var mySchedule = new GlideRecord('cmn_schedule_span');
mySchedule.get('schedule', myCabParent.sys_id);
myScheduleString = mySchedule.repeat_until;

var myDate = new GlideDateTime(myScheduleString.substring(0, 4) + '-' + myScheduleString.substring(4, 6) + '-' + myScheduleString.substring(6, 8));

myDate.addDaysLocalTime(7);
mySchedule.repeat_until = myDate.toString().substring(0, 10);
mySchedule.update();

 

Part that I would need updated is

if (myNewMeeting.next()) {
    var cabMeeting = new sn_change_cab.CABMeeting(myNewMeeting);
    cabMeeting.refreshChangeAgendaItems();
    cabMeeting.createCABAttendeeNotifyEvents(now);
}

 

Thank you for any help.

0 REPLIES 0