Workflow - startFlowFromContextInsert(GlideRecord context, String operation)

Helper method for business rule Auto start on context.

Table 1. Parameters
Name Type Description
context GlideRecord GlideRecord on table wf_context of a new record (the "current" record in the business rule).
operation String Database operation being performed. One of insert, update, delete.
>
Table 2. Returns
TypeDescription
void
//where current is a task record with a workflow context
      current.name = current.workflow_version.name;
      current.started_by.setValue(gs.userID());
      
      if (gs.nil(current.id)) {
        var gr = new GlideRecord('wf_workflow_execution');
        gr.name = current.name;
        gr.insert();
      
        current.table = 'wf_workflow_execution';
        current.id = gr.sys_id;
      }
      
      var wf = new Workflow();
      wf.startFlowFromContextInsert(current, current.operation())