Name

global.MIDServerFileSync

Description

Checks to see if there are any changes to attachments on tables that are instances of MID server synchronized files, and if so, notifies the MID servers of a change.

Script

var MIDServerFileSync = Class.create();

MIDServerFileSync.process = function() {
  var base = '' + GlideDBObjectManager.get().getBase(event.parm1);
  if (base != 'ecc_agent_sync_file')
      return;
  //MIDScript DBlistner will notify any changes in attachment for ecc script files 
  if (event.parm1 == 'ecc_agent_script_file') 
  	return;
  
  
  var msfs = new MIDServerFileSync();
  msfs.notifyMIDServers(event.parm1);
}

MIDServerFileSync.prototype = {
  initialize: function() {
  },

  notifyMIDServers: function(table) {
      var gr = new GlideRecord('ecc_queue');
      gr.initialize();
      gr.setValue( 'agent',  'mid.server.*'  );
      gr.setValue( 'source', 'FileChange'    );
      gr.setValue( 'name',   table           );
      gr.setValue( 'topic',  'SystemCommand' );
      gr.setValue( 'queue',  'output'        );
      gr.setValue( 'state',  'ready'         );
  	gr.setValue( 'priority', '0'           );
      gr.insert();
      
  },
  
  type: MIDServerFileSync
}

Sys ID

d683660583101000dada83ec37d9296a

Offical Documentation

Official Docs: