LogoLogo
AboutSupport
2.2
2.2
  • Unifi Documentation
  • Release
    • Release Notes
      • 2.1 Release Notes
      • 2.0 Release Notes
    • Hotfixes
    • Setup
  • Overview
    • Quick Tour
    • Supported Features
    • Application Module Overview
  • Integration Guides
    • Outbound Incident Guide
      • Getting Started
      • Process
      • Integration
      • Connection
      • Trigger
      • Create Scenario
        • CreateIncidentResponse Message
        • CreateIncidentResponse Fields
        • CreateIncident Message
        • CreateIncident Fields
        • Test CreateIncident
      • Update Scenario
        • Response Message
        • UpdateIncident Message
        • UpdateIncident Fields
        • Test UpdateIncident
      • Resolve Scenario
        • ResolveIncident Message
        • ResolveIncident Fields
        • Test ResolveIncident
      • Build - Integration Level
      • Conclusion
    • Bidirectional Asynchronous Incident Guide
      • Getting Started
      • Process
      • Web Service
      • Integration
      • Connection
      • Trigger
      • Create Scenario
        • Response Message
        • CreateIncidentReceipt Message
        • CreateIncidentReceipt Fields
        • CreateIncident Message
        • CreateIncident Fields
        • Test CreateIncident
      • Update Scenario
        • Receipt Message
        • UpdateIncident Message
        • UpdateIncident Fields
        • Test UpdateIncident
      • Resolve Scenario
        • ResolveIncident Message
        • ResolveIncident Fields
        • Test ResolveIncident
      • Build - Integration Level
      • Build the Other Half
        • Move the Integration
        • Reconfigure the Connections
      • Conclusion
    • Incident Update Poller Guide
      • Polling
        • Poll Processor
        • Poller
      • Inbound Message
        • UpdateIncidentInbound Message
        • UpdateIncidentInbound Fields
      • Message Identification
      • Bond Identification
        • Edit Incident Form
        • Edit CreateIncident Message
      • Test Update Poll
      • Conclusion
    • Incident Multiple Message Poller Guide
      • Polling
        • Poll Processor
        • Poller
      • Inbound Messages
        • ResolveIncidentInbound Message
        • ResolveIncidentInbound Fields
      • Testing
        • Test UpdateIncidentInbound
        • Test ResolveIncidentInbound
      • Conclusion
    • Incident Create Poller Guide
      • Polling
        • Connection Variables
        • Poll Processor
        • Poller
      • Messages
        • CreateIncidentInboundReceipt Message
        • CreateIncidentInboundReceipt Fields
        • CreateIncidentInbound Message
        • CreateIncidentInbound Fields
      • Build - Integration Level
      • Test Create Poll
      • Conclusion
    • Incident Parent and Child Poller Guide
      • Polling
        • Connection Variables
        • Child Poll Processor
        • Child Poller
        • Parent Poll Processor
        • Parent Poller
      • Inbound Messages
      • Testing
        • Test UpdateIncidentInbound
        • Test ResolveIncidentInbound
      • Conclusion
    • Incident Attachment Poller Guide
      • Polling
        • Connection Variables
        • Edit Endpoint URLs
        • Get Attachment Poll Processor
        • Get Attachment Poller
        • Select Attachments Poll Processor
        • Select Attachments Poller
        • Edit Child Poll Processor
        • Edit Child Update Poller
      • Messages
        • AddAttachmentInbound Message
      • Testing
        • Test Outbound Scenarios
        • Test CreateIncidentInbound
        • Test UpdateIncidentInbound
        • Test ResolveIncidentInbound
        • Test AddAttachmentInbound
      • Conclusion
  • Feature Guides
    • Packager Feature Guide
      • Instructions
    • Error Handling Tools Feature Guide
      • Retry
      • Replay
      • Ignore
      • Repair
      • Pause and Resume
  • Bonding
    • Bonds
    • Bonded Attachments
  • Transport
    • Transport Data Flow
    • Transactions
    • Stages
    • HTTP Requests
    • Response Actions
  • Configuration
    • Processes
    • Integrations
    • Connections
    • Messages
    • Message Scripts
    • Fields
    • Field Maps
    • Event Actions
  • Polling
    • Pollers
    • Poll Processors
    • Poll Requests
    • Large Response Payloads
  • Administration
    • Activity Logs
    • Data Stores
    • Properties
    • Scheduled Scripts
    • System Logs
    • Self-test
  • Scripting
    • Variables
    • Snippets
  • Attachments
    • Attachment Handling
    • Multipart Form Data
Powered by GitBook
On this page

Was this helpful?

Export as PDF
  1. Release

Hotfixes

Unifi can be patched between releases by using a special Script Include called hotfix. This page contains any hotfixes that have been made for this version. Follow the instructions to apply them.

If you find a bug in Unifi we may issue a hotfix so you can get the features you need without having to upgrade.

Unifi has a Script Include called hotfix. Simply replace the script in the hotfix Script Include with the one shown below and you will instantly have access to the fixes.

These hotfixes will be shipped as real fixes with the next version of Unifi, so make sure you have the correct hotfix for your version.

/**
 * Executes a child function corresponding to the object's type property.
 * The object is passed to the child function so methods and properties can be overridden.
 *
 * @param  {Object} obj The full class object to be patched.
 */
function hotfix(obj) {
  var type = typeof obj === 'function' ? obj.prototype.type : obj.type;
  if (type && typeof hotfix[type] === 'function') {
    hotfix[type](obj);
  }
}

hotfix.version = '2.2.1.4';

hotfix.EventAction = function (EventAction) {

  /**
   * Process this Event action given the current record
   * @param  {[type]} current [description]
   * @return {[type]}         [description]
   */
  EventAction.prototype.process = function process(current) {
    // Check if we have condition script, and if so does it match?
    if (this.isAdvanced() && !this._runScript('condition_script', { current: current })) {
      return;
    }

    // Check condition filter against the given table, and check if it matches
    // the limit
    if (!this.isAdvanced() && !this.doesTriageFilterMatch()) {
      return;
    }

    // If either of the above match, run the action script
    this._runScript('action_script', { current: current });
  };

  /**
   * Runs the Event Actions filter against its table and checks with the limit field
   * to determine if the threshold has been met.
   *
   * @return {Boolean}
   */
  EventAction.prototype.doesTriageFilterMatch = function doesTriageFilterMatch() {
    var ga,
        count;

    // If we do not have a table then we cannot run the filter, detaults to a correct match
    if (this.getValue('table') == null) {
      ws_console.debug('Table not found, triage matches');
      return true;
    }

    ga = new GlideAggregate(this.getValue('table'));
    ga.addEncodedQuery(this.getValue('filter'));
    ga.addAggregate('COUNT');
    ws_console.logQuery(ga);

    count = ga.next() ? ga.getAggregate('COUNT') : 0;
    ws_console.debug('Record count is %0', [count]);

    return (count >= this.getValue('limit'));
  };

  /**
   * Finds all active event actions that match the given criteria. Each matching Event Action
   * is then process to ascertain whether the action should be executed or not, i.e.
   * if the conditions have been met.
   *
   * @param  {String} event        Event name to find Event Actions for
   * @param  {GlideRecord} current The GlideRecord that this event was triggered for
   * @param  {String} integration  Integration sys_id
   * @param  {String} message      Message sys_id
   */
  EventAction.process = function process(event, current, integration, message) {
    var gr,
        query = [],
        config = new Process().getConfig();

    gr = new GlideRecord('x_snd_eb_event_action');
    gr.addQuery('event', '=', event);
    gr.addQuery('active', '=', 'true');
    if (integration) {
      query.push('integration=' + integration);
      query.push('ORintegrationISEMPTY');
      if (message) {
        query.push('message=' + message);
        query.push('ORmessageISEMPTY');
      } else {
        query.push('messageISEMPTY');
      }
    } else {
      query.push('integrationISEMPTY');
    }
    gr.addEncodedQuery(query.join('^'));
    gr.orderByDesc('integration');
    gr.orderByDesc('message');
    ws_console.logQuery(gr);

    while(gr.next()) {
      new EventAction(config, gr).process(current);
    }
  };
};

hotfix.Transaction = function (Transaction) {

  // Fix transaction/bond domains for inbound create messages
  Transaction.prototype.setBond = function setBond(bond) {
    this.bond = bond;
    this.setValue('bond', bond.getValue('sys_id'));

    // The bond will be created in global so we should update it to match
    // incoming transactions which are created in the domain of the integration user .
    if (bond.getValue('sys_domain') == 'global' && bond.isNew() && this.getValue('direction') == 'Inbound') {
      bond.setValue('sys_domain', this.getValue('sys_domain'));
    }

    this.setValue('sys_domain', bond.getValue('sys_domain'));
  };
};

hotfix.Message = function (Message) {
  Message.prototype.evaluateScript = function evaluateScript(record, element, vars) {
    var source = vars.source;
    var result;
    vars.message = this.getRecord();
    vars.variables = this.getIntegration().getActiveConnection().getVariables();
    if (vars.stage) {
      vars.$stage = vars.stage.$stage;
    }
    result = utils.evaluateScript(record, element, vars);

    // UN-1003: reset source - GlideScopedEvaluator changes the GlideRecord object
    // to ScopedGlideRecord which breaks object equality.
    if (source && source.$model) {
        source.$model.setRecord(source);
    }

    return result;
  };
}
Previous2.0 Release NotesNextSetup

Last updated 3 years ago

Was this helpful?