Create a new Scheduled Job, making sure that it is in the VividCharts Application Scope.
Paste the following script listed below into the script portion of the Scheduled Job.
Script:
// Config variables
var view = "32999b0edb9bce50ee8ca09e13961981"; // The view to be refreshed
var userDisplay = "System"; // The name that will appear under refresh info
// Get the published slide deck sys_id for the view to be refreshed
var sys_id = null;
var viewGR = new GlideRecord("x_vivid_vc_core_view_slides_connection");
if (viewGR.get("view", view)) {
sys_id = viewGR.slides.published.toString();
}
// Only refresh if we got a slide deck sys_id
if (sys_id) {
var historyID = CollectionHistory.startCollection({
"user": userDisplay,
"userDisplay": userDisplay,
"view": view
});
// create an event
var asyncInputs = {
sys_id: sys_id,
target: null,
userDisplay: userDisplay,
historyID: historyID
};
// add a collection task to the queue
var queueQuery = new GlideRecord("x_vivid_vc_core_queue_results");
queueQuery.finished = false;
queryID = queueQuery.insert();
var queryInputs = JSON.stringify(asyncInputs);
gs.eventQueue('x_vivid_vc_core.refresh_view', queueQuery, queryInputs);
}
Next, change the View sys_id located in line 2. You can locate the correct View sys_id from the x_vivid_vc_core_views table. Search for the view by title and copy the View sys_id.
Paste the copied View sys_id into the
var view = "32999b0edb9bce50ee8ca09e13961981";
portion of the code.You can create a new Scheduled Job for each view that you would like to refresh more than once daily.
โ
โ