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.

Schedule job for refresh agenda item

Asha Pathak
Tera Contributor

Hello Community!

 

I have one requirement 

When Refreshing the CAB Meeting Agenda items, you have an option to email yes or no, then refresh shuffles the agenda items for the scheduled CAB.

As a user, can we schedule the refresh daily at 9:00 AM so that the agenda items are up to date.

 

I have created one schedule job , but email not sent and please explain how exactly when we refresh agenda what is the process?

var encQuery = 'startONToday@javascript:gs.beginningOfToday()@javascript:gs.endOfToday()^active=true';
var grMeeting = new GlideRecord('cab_meeting');
grMeeting.addEncodedQuery(encQuery);
grMeeting.query();

while (grMeeting.next()) {
    gs.print("inside while");
    if (grMeeting.getRowCount() == 1) {
        gs.print("inside if");
        var cabAgendaClass = new sn_change_cab.CABMeeting(grMeeting);
        cabAgendaClass.refreshChangeAgendaItems();
        cabAgendaClass.refreshAgendaItemsAndEmail();
        cabAgendaClass.update();
        gs.print('This scheduled job was successful');
    } else {
        gs.print('The Scheduled Job failed for Automate CAB Refresh Agenda Items');
    }
}

please help!

1 REPLY 1

Asha Pathak
Tera Contributor

UI action for refresh agenda is 

 

function sendEmailsOnRefreshAI() {
    var dialog = new GlideModal('sn_change_cab_send_attendee_notifications');
    dialog.setTitle(new GwtMessage().getMessage('Agenda items refreshed'));
    dialog.setPreference('refreshAgendaItems',  refreshAgendaItems.bind(this, dialog));
    dialog.setPreference('refreshAgendaItemsAndEmail',  refreshAgendaItemsAndEmail.bind(this, dialog));
    dialog.render();    
}

function refreshAgendaItems(dialog) {
    dialog.destroy();
    gsftSubmit(null, g_form.getFormElement(), 'sn_change_cab_refresh_ai');
}

function refreshAgendaItemsAndEmail(dialog) {
    dialog.destroy();
    gsftSubmit(null, g_form.getFormElement(), 'sn_change_cab_refresh_ai_and_email');
}