how to create a Scheduled Job to call the UI Action "Refresh Agenda Items" in CAB Meeting

paul_miller
Giga Contributor

Hello,

I have requirement to send the CAB Meeting Invites at 10 PM every Monday Night and Wednesday night. I have been successful in scheduling the notification, with one issue. We need the "Refresh Agenda Items" UI Action to be clicked right before to refresh changes and make sure the correct Attendees are notified. Anyone know if this is possible? It is my understanding that we cannot schedule an onClick event via scheduled job.

 

Below is the UI Action script for the "Refresh Agenda Items" UI Action :

 

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');
}

 

 

Any help would be greatly appreciated!

 

Thanks in advance!

 

Paul Miller

 

3 REPLIES 3

Stewe Lundin
Mega Guru

No you cant schedule a UI action, all schedules are server side.  

Perhaps you can send a popup (addInfoMessage) to the correct attendees with relevant information. 

We do that when we have incidents with priority 1 

 

 

 

Jason174
Tera Guru

You ever find and an answer to this?  The other answer doesn't make sense considering it uses a UI page that is running server side code...

 

There has to be code behind this, but I can't find the page it calls to make it happen.

_ChrisHelming
Tera Guru

The two lines in that UI action that matter are:

gsftSubmit(null, g_form.getFormElement(), 'sn_change_cab_refresh_ai');
gsftSubmit(null, g_form.getFormElement(), 'sn_change_cab_refresh_ai_and_email');

That third parameter is calling a UI Action (sys_ui_action) using the value in the action_name column (not shown OOB).

If you go to sys_ui_action.list and add the action_name column, or filter for Action name = sn_change_cab_refresh_ai_and_email you should find a UI Action called "Refresh agenda items (with emails)"

Inside that UI Action, the part you'll care about and want to run as a schedule job is the following:

var cabMeeting = new sn_change_cab.CABMeeting(current);
cabMeeting.refreshChangeAgendaItems();

where "current" is the sys_id of the CAB meeting you want to refresh.

Example of a scheduled job that sends notifications:

var gr = new GlideRecord('cab_meeting');
gr.addEncodedQuery('startONToday@javascript:gs.beginningOfToday()@javascript:gs.endOfToday()');
gr.query();
if (gr.next()) {
    var now = new GlideDateTime();
    var cabMeeting = new sn_change_cab.CABMeeting(gr.sys_id);
    cabMeeting.refreshChangeAgendaItems();
    cabMeeting.createCABAttendeeNotifyEvents(now);
}