Workflow - startFlowRetroactive(String workflowId, Number retroactiveMSecs, GlideRecord current, String operation, Array, ???)

Used by business rule Start Workflow on table task_sla. This starts a workflow and the extra arguments to this method are used by activity "Timer" to pause the execution of the workflow for some duration.

Table 1. Parameters
Name Type Description
workflowID String The sys_id of the workflow to start. This sys_id refers to table wf_workflow.
retroactiveMSecs Number Delay in milliseconds used by Activity Timer.
current GlideRecord GlideRecord of the record to use as current in this workflow. This is normally from the Table field of the workflow properties for this workflow
operation String Database operation being performed.One of insert, update, delete.
vars Array Collection of variables to add to the workflow.
withSchedule ??? Schedule used by Activity Timer
Table 2. Returns
Type Description
GlideRecord A GlideRecord on table wf_context on the inserted record for this newly created workflow context.
// is this a retroactive start?
      ////where current is a task record with a workflow context
      var msecs = new GlideDateTime().getNumericValue() - current.start_time.getGlideObject().getNumericValue();
      // treat this as a retroactive workflow start if the SLA started more than 5 seconds ago
      var w = new Workflow();
      if (msecs <= 5000)
        w.startFlow(id, current, current.operation());
        w.startFlowRetroactive(id, msecs, current, current.operation());
      // update the record in case the workflow changed some values