📁 Showcase
Automation

Automations

1. AutomateTaskSheet

ensure automation AutomateTaskSheet kind: spreadsheet
  spreadsheet: TaskSheet

a. BeforeInsert event

ensure event BeforeInsert fire: beforeInsert

ensure pipelineVar P1 form: PrivateRowIdResult

i. GetRows step

ensure var VarConditionDoesTaskIdMatchExisting1 kind: condition 
  deploy: fixedOnDeploy
  value: "<root>
      <stmt>${f:Details.Id} == ${in:Details.Id}</stmt>
    </root>" 
  sourceForm: EntityTask 
  inputForm: EntityTask

ensure var VarMappingTaskToPrivateRowIdResult1 kind: mapping 
  deploy: fixedOnDeploy
  fromForm: EntityTask 
  toForm: PrivateRowIdResult 
  fieldMappingMap: {
      'map': {
        '${ctx:row.id}': 'Details.RowId'
      }
    }

// step, getSpreadsheetRows, GetSpreadsheetRows
ensure automation AutomateTaskSheet
ensure event BeforeInsert
ensure step GetSpreadsheetRows kind: getSpreadsheetRows 
  targetSpreadsheet: TaskSheet 
  targetSpreadsheetFilterVar: VarConditionDoesTaskIdMatchExisting1 
  outputFormPipelineVar: P1 
  targetToSourceMappingVar: VarMappingTaskToPrivateRowIdResult1

ii. RemoveField step

// step, removeField, RemoveFieldFormMode
ensure step RemoveFieldFormMode kind: removeField 
  removeField: Other.FormMode

iii. CopyRowId step

ensure var VarMappingPrivateRowIdResultToTask1 kind: mapping 
  deploy: fixedOnDeploy
  fromForm: PrivateRowIdResult 
  toForm: EntityTask 
  fieldMappingMap: {
      'map': {
        '${f:Details.RowId}': 'Other.RowId'
      }
    }

// step, copyField, CopyRowIdToCurrentForm
ensure automation AutomateTaskSheet
ensure event BeforeInsert
ensure step CopyRowId kind: copyField 
  sourcePipelineVar: P1 
  mappingVar: VarMappingPrivateRowIdResultToTask1

iv. UpdateSheet step

ensure var VarConditionDoesRowExist kind: condition 
  deploy: fixedOnDeploy
  value: "<root>
      <stmt>${in:Details.RowId} has value</stmt>
    </root>" 
  sourceForm: EntityTask 
  inputForm: PrivateRowIdResult

ensure var VarMappingTaskToTask1 kind: mapping 
  deploy: fixedOnDeploy
  fromForm: EntityTask 
  toForm: EntityTask 
  fieldMappingMap: {
      'map': {
        '${f:Details.Id}': 'Details.Id',
        '${f:Details.Subject}': 'Details.Subject',
        '${f:Details.Description}': 'Details.Description',
        '${f:Details.DueDate}': 'Details.DueDate',
        '${f:Details.Status}': 'Details.Status',
        '${f:Details.Priority}': 'Details.Priority',
        '${f:Details.AssignedTo}': 'Details.AssignedTo',
        '${f:Details.RelatedToId}': 'Details.RelatedToId',
        '${f:Details.RelatedToValue}': 'Details.RelatedToValue',
        '${f:Details.RelatedTo}': 'Details.RelatedTo',
        '${f:Other.RowId}': 'Other.RowId'
      }
    }

// step, updateSpreadsheet, UpdateSpreadsheetEventSheet
ensure automation AutomateTaskSheet
ensure event BeforeInsert
ensure step UpdateSpreadsheetTaskSheet kind: updateSpreadsheet 
  executionConditionVar: VarConditionDoesRowExist 
  executionConditionInputPipelineVar: P1 
  targetSpreadsheet: TaskSheet 
  rowIdField: Other.RowId 
  sourceToTargetMappingVar: VarMappingTaskToTask1

v. Terminate step

// step, terminate, Terminate
ensure step Terminate kind: terminate 
  executionConditionVar: VarConditionDoesRowExist 
  executionConditionInputPipelineVar: P1

vi. CreateRecord step

ensure var VarConditionDoesRowNotExistInTaskSheet kind: condition 
  deploy: fixedOnDeploy
  value: "<root>
      <and>
        <stmt>${in:Details.RowId} has no value</stmt>
        <stmt>${f:Details.Id} has no value</stmt>
      </and>
    </root>" 
  sourceForm: EntityTask 
  inputForm: PrivateRowIdResult

ensure var VarMappingTaskToCreateTask1 kind: mapping 
  deploy: fixedOnDeploy
  fromForm: EntityTask 
  toPlugin: SalesforcePlugin 
  toForm: CreateTask 
  fieldMappingMap: {
      'map': {
        '${f:Details.Subject}': 'Subject',
        '${f:Details.Description}': 'Description',
        '${f:Details.DueDate}': 'DueDate',
        '${f:Details.Status}': 'Status',
        '${f:Details.Priority}': 'Priority',
        '${f:Details.AssignedTo}': 'AssignedTo',
        '${f:Details.RelatedTo}': 'RelatedTo'
      }
    }

ensure var VarMappingCreatedRecordIdToTask kind: mapping 
  deploy: fixedOnDeploy
  fromPlugin: SalesforcePlugin 
  fromForm: CreatedRecordId 
  toForm: EntityTask 
  fieldMappingMap: {
      'map': {
        '${f:Details.Id}': 'Details.Id'
      }
    }

// step, callPlugin, CreateRecordIntoSalesforce
ensure automation AutomateTaskSheet
ensure event BeforeInsert
ensure step CreateRecordIntoSalesforce kind: callPlugin 
  executionConditionVar: VarConditionDoesRowNotExistInTaskSheet 
  executionConditionInputPipelineVar: P1 
  targetPlugin: SalesforcePlugin 
  targetPluginApi: CreateTask 
  pluginInputMappingVar: VarMappingTaskToCreateTask1 
  pluginOutputMappingVar: VarMappingCreatedRecordIdToTask

b. AfterInsert event

// event, AfterInsert
ensure event AfterInsert fire: afterInsert

i. ForwardToGroups step

// step, forwardToGroups, ForwardToGroups
ensure step ForwardToGroups kind: forwardToGroups 
  senderRole: $Self
  groups: [Salesforce, MyAssistant]

c. AfterUpdate event

// event, AfterUpdate
ensure event AfterUpdate fire: afterUpdate

i. UpdateTask step

ensure var VarMappingTaskToCreateTask2 kind: mapping 
  deploy: fixedOnDeploy
  fromForm: EntityTask 
  toPlugin: SalesforcePlugin 
  toForm: CreateTask 
  fieldMappingMap: {
      'map': {
        '${f:Details.Id}': 'Id',
        '${f:Details.Subject}': 'Subject',
        '${f:Details.Description}': 'Description',
        '${f:Details.DueDate}': 'DueDate',
        '${f:Details.Status}': 'Status',
        '${f:Details.Priority}': 'Priority',
        '${f:Details.AssignedTo}': 'AssignedTo',
        '${f:Details.RelatedTo}': 'RelatedTo'
      }
    }

// step, callPlugin, UpdateAccountInSalesforce
ensure automation AutomateTaskSheet
ensure event AfterUpdate
ensure step UpdateTaskInSalesforce kind: callPlugin 
  targetPlugin: SalesforcePlugin 
  targetPluginApi: UpdateTask 
  pluginInputMappingVar: VarMappingTaskToCreateTask2

d. BeforeRemove event

// event, BeforeRemove
ensure event BeforeRemove fire: beforeRemove

i. RemoveRecord step

ensure var VarMappingTaskToRecordIdInputForm1 kind: mapping 
  deploy: fixedOnDeploy
  fromForm: EntityTask 
  toPlugin: SalesforcePlugin 
  toForm: RecordIdInputForm 
  fieldMappingMap: {
      'map': {
        '${f:Details.Id}': 'Id'
      }
    }

// step, callPlugin, RemoveFromSalesforce
ensure automation AutomateTaskSheet
ensure event BeforeRemove
ensure step RemoveTaskFromSalesforce kind: callPlugin 
  targetPlugin: SalesforcePlugin 
  targetPluginApi: RemoveRecord 
  pluginInputMappingVar: VarMappingTaskToRecordIdInputForm1

2. AutomateTaskWebhook

ensure automation AutomateSalesforcePluginTaskDetailWebhook kind: pluginWebhook 
  plugIn: SalesforcePlugin 
  pluginApi: TaskDetailWebhook

a. OnCallback event

ensure event OnCallback fire: onCallback

ensure pipelineVar PipelineRowExist form: PrivateRowIdResult
ensure pipelineVar PipelineTask form: EntityTask

i. CopyTask step

ensure var VarMappingTaskDetailToTask2 kind: mapping 
  deploy: fixedOnDeploy
  fromPlugin: SalesforcePlugin 
  fromForm: TaskDetail 
  toForm: EntityTask 
  fieldMappingMap: {
      'map': {
        '${f:Details.Id}': 'Details.Id',
        '${f:Details.Subject}': 'Details.Subject',
        '${f:Details.DueDate}': 'Details.DueDate',
        '${f:Details.Status}': 'Details.Status',
        '${f:Details.Priority}': 'Details.Priority',
        '${f:Details.AssignedTo}': 'Details.AssignedTo',
        '${f:Details.RelatedTo}': 'Details.RelatedTo',
        '${f:Details.Description}': 'Details.Description'
      }
    }

// step, copyField, CopyTaskDetailToPipeline
ensure automation AutomateSalesforcePluginTaskDetailWebhook
ensure event OnCallback
ensure step CopyTaskDetailToPipeline kind: copyField 
  targetPipelineVar: PipelineTask 
  mappingVar: VarMappingTaskDetailToTask2

ii. GetRows step

ensure var VarConditionDoesTaskIdMatchExisting2 kind: condition 
  deploy: fixedOnDeploy
  value: "<root>
      <stmt>${in:Details.Id} == ${f:Details.Id}</stmt>
    </root>" 
  sourceForm: EntityTask 
  inputForm: EntityTask

ensure var VarMappingTaskToRowIdResult kind: mapping 
  deploy: fixedOnDeploy
  fromForm: EntityTask 
  toForm: PrivateRowIdResult 
  fieldMappingMap: {
      'map': {
        '${ctx:row.id}': 'Details.RowId'
      }
    }

// step, getSpreadsheetRows, GetSpreadsheetRows
ensure automation AutomateSalesforcePluginTaskDetailWebhook
ensure event OnCallback
ensure step GetSpreadsheetRows kind: getSpreadsheetRows 
  targetSpreadsheet: TaskSheet 
  targetSpreadsheetFilterVar: VarConditionDoesTaskIdMatchExisting2 
  inputFormPipelineVar: PipelineTask 
  outputFormPipelineVar: PipelineRowExist 
  targetToSourceMappingVar: VarMappingTaskToRowIdResult

iii. CopyRowId step

ensure var VarMappingPrivateRowIdResultToTask2 kind: mapping 
  deploy: fixedOnDeploy
  fromForm: PrivateRowIdResult 
  toForm: EntityTask 
  fieldMappingMap: {
      'map': {
        '${f:Details.RowId}': 'Other.RowId'
      }
    }

// step, copyField, CopyRowIdToPipeline
ensure automation AutomateSalesforcePluginTaskDetailWebhook
ensure event OnCallback
ensure step CopyRowIdToPipeline kind: copyField 
  sourcePipelineVar: PipelineRowExist 
  targetPipelineVar: PipelineTask 
  mappingVar: VarMappingPrivateRowIdResultToTask2

iv. UpdateSheet step

ensure var VarMappingTaskToTask2 kind: mapping 
  deploy: fixedOnDeploy
  fromForm: EntityTask 
  toForm: EntityTask 
  fieldMappingMap: {
      'map': {
        '${f:Details.Id}': 'Details.Id',
        '${f:Details.Subject}': 'Details.Subject',
        '${f:Details.Description}': 'Details.Description',
        '${f:Details.DueDate}': 'Details.DueDate',
        '${f:Details.Status}': 'Details.Status',
        '${f:Details.Priority}': 'Details.Priority',
        '${f:Details.AssignedTo}': 'Details.AssignedTo',
        '${f:Details.RelatedTo}': 'Details.RelatedTo'
      }
    }

// step, updateSpreadsheet, UpdateSpreadsheetTaskSheet
ensure automation AutomateSalesforcePluginTaskDetailWebhook
ensure event OnCallback
ensure step UpdateSpreadsheetTaskSheet kind: updateSpreadsheet 
  executionConditionInputPipelineVar: PipelineRowExist 
  targetSpreadsheet: TaskSheet 
  inputFormPipelineVar: PipelineTask 
  rowIdField: Other.RowId 
  sourceToTargetMappingVar: VarMappingTaskToTask2