📁 Showcase
Automation

Automations

1. Private forms

ensure form PrivateRowIdResult 
ensure section: Details
ensure field RowId kind: rowId

2. AutomateAccountSheet

ensure automation AutomateAccountSheet kind: spreadsheet 
  spreadsheet: AccountSheet

a. BeforeInsert event

ensure event BeforeInsert fire: beforeInsert

ensure pipelineVar P1 form: PrivateRowIdResult

i. GetRows step

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

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

ensure automation AutomateAccountSheet
ensure event BeforeInsert
ensure step GetSpreadsheetRows kind: getSpreadsheetRows 
  targetSpreadsheet: AccountSheet 
  targetSpreadsheetFilterVar: VarConditionFilterAccountRows 
  outputFormPipelineVar: P1 
  targetToSourceMappingVar: VarMappingAccountToPrivateRowIdResult2

ii. RemoveField step

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

iii. UpdateSheet step

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

ensure var VarMappingAccountToAccount kind: mapping 
  deploy: fixedOnDeploy
  fromForm: EntityAccount 
  toForm: EntityAccount 
  fieldMappingMap: {
      'map': {
        '${f:Details.Name}': 'Details.Name',
        '${f:Details.AccountNumber}': 'Details.AccountNumber',
        '${f:Details.Phone}': 'Details.Phone',
        '${f:Details.BillingState}': 'Details.BillingState',
        '${f:Details.AccountSite}': 'Details.AccountSite',
        '${f:Details.Type}': 'Details.Type',
        '${f:Details.Industry}': 'Details.Industry',
        '${f:Details.Owner}': 'Details.Owner',
        '${f:Other.RowId}': 'Other.RowId'
      }
    }

// step, updateSpreadsheet, UpdateSpreadsheet
ensure automation AutomateAccountSheet
ensure event BeforeInsert
ensure step UpdateSpreadsheet kind: updateSpreadsheet 
  executionConditionVar: VarConditionDoesAccountExist 
  executionConditionInputPipelineVar: P1 
  targetSpreadsheet: AccountSheet 
  rowIdField: Other.RowId 
  sourceToTargetMappingVar: VarMappingAccountToAccount

iv. Terminate step

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

v. CreateAccount step

ensure var VarMappingAccountToCreateAccount kind: mapping 
  deploy: fixedOnDeploy
  fromForm: EntityAccount 
  toPlugin: SalesforcePlugin 
  toForm: CreateAccount 
  fieldMappingMap: {
      'map': {
        '${f:Details.Id}': 'Id',
        '${f:Details.Name}': 'Name',
        '${f:Details.AccountSite}': 'AccountSite',
        '${f:Details.AccountNumber}': 'AccountNumber',
        '${f:Details.Phone}': 'Phone',
        '${f:Details.BillingState}': 'BillingState',
        '${f:Details.Type}': 'Type',
        '${f:Details.Industry}': 'Industry',
        '${f:Details.Owner}': 'Owner'
      }
    }

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

// step, callPlugin, CreateAccountInSalesforce
ensure automation AutomateAccountSheet
ensure event BeforeInsert
ensure step CreateAccountInSalesforce kind: callPlugin 
  executionConditionVar: VarConditionDoesAccountNotExist 
  executionConditionInputPipelineVar: P1 
  targetPlugin: SalesforcePlugin 
  targetPluginApi: CreateAccount 
  pluginInputMappingVar: VarMappingAccountToCreateAccount 
  pluginOutputMappingVar: VarMappingCreatedRecordIdToAccount

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]

c. AfterUpdate event

// event, AfterUpdate
ensure event AfterUpdate fire: afterUpdate

i. UpdateAccount step

// step, callPlugin, UpdateAccountInSalesforce
ensure step UpdateAccountInSalesforce kind: callPlugin 
  targetPlugin: SalesforcePlugin 
  targetPluginApi: UpdateAccount 
  pluginInputMappingVar: VarMappingAccountToCreateAccount

d. BeforeRemove event

// event, BeforeRemove
ensure event BeforeRemove fire: beforeRemove

i. CallPlugin step

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

// step, callPlugin, CallPlugin
ensure automation AutomateAccountSheet
ensure event BeforeRemove
ensure step CallPlugin kind: callPlugin 
  targetPlugin: SalesforcePlugin 
  targetPluginApi: RemoveRecord 
  pluginInputMappingVar: VarMappingAccountToRecordInputForm

3. AutomateAccountWebhook

ensure automation AutomateSalesforcePluginAccountDetailWebhook kind: pluginWebhook 
  plugIn: SalesforcePlugin 
  pluginApi: AccountDetailWebhook

a. OnCallback event

ensure event OnCallback fire: onCallback

ensure pipelineVar PipelineRowExist form: PrivateRowIdResult
ensure pipelineVar PipelineResultTempAccount form: EntityAccount

i. CopyAccount step

ensure var VarMappingAccountDetailToAccount1 kind: mapping 
  deploy: fixedOnDeploy
  fromPlugin: SalesforcePlugin 
  fromForm: AccountDetail 
  toForm: EntityAccount 
  fieldMappingMap: {
      'map': {
        '${f:Details.Id}': 'Details.Id',
        '${f:Details.Name}': 'Details.Name',
        '${f:Details.AccountNumber}': 'Details.AccountNumber',
        '${f:Details.Phone}': 'Details.Phone',
        '${f:Details.BillingState}': 'Details.BillingState',
        '${f:Details.AccountSite}': 'Details.AccountSite',
        '${f:Details.Type}': 'Details.Type',
        '${f:Details.Industry}': 'Details.Industry',
        '${f:Details.Owner}': 'Details.Owner'
      }
    }

// step, copyField, CopyAccountDetailToPipelineVar
ensure automation AutomateSalesforcePluginAccountDetailWebhook
ensure event OnCallback
ensure step CopyAccountDetailToPipelineVar kind: copyField 
  targetPipelineVar: PipelineResultTempAccount 
  mappingVar: VarMappingAccountDetailToAccount1

ii. GetRows step

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

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

// step, getSpreadsheetRows, GetSpreadsheetRows
ensure automation AutomateSalesforcePluginAccountDetailWebhook
ensure event OnCallback
ensure step GetSpreadsheetRows kind: getSpreadsheetRows 
  targetSpreadsheet: AccountSheet 
  targetSpreadsheetFilterVar: VarConditionDoestAccountIdMatchReceived 
  inputFormPipelineVar: PipelineResultTempAccount 
  outputFormPipelineVar: PipelineRowExist 
  targetToSourceMappingVar: VarMappingAccountToPrivateRowIdResult1

iii. CopyRowId step

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

// step, copyField, CopyRowIdToPipeline
ensure automation AutomateSalesforcePluginAccountDetailWebhook
ensure event OnCallback
ensure step CopyRowIdToPipeline kind: copyField 
  sourcePipelineVar: PipelineRowExist 
  targetPipelineVar: PipelineResultTempAccount 
  mappingVar: VarMappingPrivateRowIdResultToAccount

iv. UpdateSheet step

// step, updateSpreadsheet, UpdateSpreadsheetAccountSheet
ensure step UpdateSpreadsheetAccountSheet kind: updateSpreadsheet 
  executionConditionInputPipelineVar: PipelineRowExist 
  targetSpreadsheet: AccountSheet 
  inputFormPipelineVar: PipelineResultTempAccount 
  rowIdField: Other.RowId 
  sourceToTargetMappingVar: VarMappingAccountToAccount