📁 Showcase
Automation

Automations

Backend

1. AutomateOpportunitySheet

ensure automation AutomateOpportunitySheet kind: spreadsheet
  spreadsheet: OpportunitySheet

a. BeforeInsert event

ensure event BeforeInsert fire: beforeInsert

ensure pipelineVar P1 form: PrivateRowIdResult
i. GetRows step
ensure var VarConditionDoesOpportunityIdMatchExisting1 kind: condition 
  deploy: fixedOnDeploy
  value: "<root>
      <stmt>${f:Details.Id} == ${in:Details.Id}</stmt>
    </root>" 
  sourceForm: EntityOpportunity 
  inputForm: EntityOpportunity

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

// step, getSpreadsheetRows, GetSpreadsheetRows
ensure automation AutomateOpportunitySheet
ensure event BeforeInsert
ensure step GetSpreadsheetRows kind: getSpreadsheetRows 
  targetSpreadsheet: OpportunitySheet 
  targetSpreadsheetFilterVar: VarConditionDoesOpportunityIdMatchExisting1 
  outputFormPipelineVar: P1 
  targetToSourceMappingVar: VarMappingOpportunityToPrivateRowIdResult2
ii. RemoveField step
// step, removeField, RemoveField
ensure step RemoveField kind: removeField 
  removeField: Other.FormMode
iii. CopyRowId step
ensure var VarMappingPrivateRowIdResultToOpportunity 
  fromForm: PrivateRowIdResult 
  toForm: EntityOpportunity 
  fieldMappingMap: {
      'map': {
        '${f:Details.RowId}': 'Other.RowId'
      }
    }

// step, copyField, CopyRowIdToCurrentForm
ensure automation AutomateOpportunitySheet
ensure event BeforeInsert
ensure step CopyRowIdToCurrentForm kind: copyField 
  sourcePipelineVar: P1 
  mappingVar: VarMappingPrivateRowIdResultToOpportunity
iv. UpdateSheet step
ensure var VarConditionDoesOpportunityRowIdMatch kind: condition 
  deploy: fixedOnDeploy
  value: "<root>
      <stmt>${in:Details.RowId} has value</stmt>
    </root>" 
  sourceForm: EntityOpportunity 
  inputForm: PrivateRowIdResult

ensure var VarMappingOpportunityToOpportunity2 kind: mapping 
  deploy: fixedOnDeploy
  fromForm: EntityOpportunity 
  toForm: EntityOpportunity 
  fieldMappingMap: {
      'map': {
        '${f:Details.Id}': 'Details.Id',
        '${f:Details.Name}': 'Details.Name',
        '${f:Details.AccountName}': 'Details.AccountName',
        '${f:Details.LeadSource}': 'Details.LeadSource',
        '${f:Details.Amount}': 'Details.Amount',
        '${f:Details.Type}': 'Details.Type',
        '${f:Details.Stage}': 'Details.Stage',
        '${f:Details.Probability}': 'Details.Probability',
        '${f:Details.OrderNumber}': 'Details.OrderNumber',
        '${f:Details.CurrentGenerator}': 'Details.CurrentGenerator',
        '${f:Details.TrackingNumber}': 'Details.TrackingNumber',
        '${f:Details.MainCompetitors}': 'Details.MainCompetitors',
        '${f:Details.DeliveryInstallationStatus}': 'Details.DeliveryInstallationStatus',
        '${f:Details.Description}': 'Details.Description',
        '${f:Other.FormMode}': 'Other.FormMode',
        '${f:Details.CloseDate}': 'Details.CloseDate'
      }
    }

// step, updateSpreadsheet, UpdateSpreadsheet
ensure automation AutomateOpportunitySheet
ensure event BeforeInsert
ensure step UpdateSpreadsheet kind: updateSpreadsheet 
  executionConditionVar: VarConditionDoesOpportunityRowIdMatch 
  executionConditionInputPipelineVar: P1 
  targetSpreadsheet: OpportunitySheet 
  rowIdField: Other.RowId 
  sourceToTargetMappingVar: VarMappingOpportunityToOpportunity2
v. Terminate step
// step, terminate, Terminate
ensure step Terminate kind: terminate 
  executionConditionVar: VarConditionDoesOpportunityRowIdMatch 
  executionConditionInputPipelineVar: P1
vi. CreateRecord step
ensure var VarConditionDoesOpportunityRowIdNotMatchAndIdHasValue 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: EntityOpportunity 
  inputForm: PrivateRowIdResult

ensure var VarMappingOpportunityToCreateOpportunity1 kind: mapping 
  deploy: fixedOnDeploy
  fromForm: EntityOpportunity 
  toPlugin: SalesforcePlugin 
  toForm: CreateOpportunity 
  fieldMappingMap: {
      'map': {
        '${f:Details.Name}': 'OpportunityName',
        '${f:Details.AccountName}': 'AccountName',
        '${f:Details.Type}': 'Type',
        '${f:Details.LeadSource}': 'LeadSource',
        '${f:Details.Stage}': 'Stage',
        '${f:Details.OrderNumber}': 'OrderNumber',
        '${f:Details.CurrentGenerator}': 'CurrentGenerator',
        '${f:Details.TrackingNumber}': 'TrackingNumber',
        '${f:Details.MainCompetitors}': 'MainCompetitors',
        '${f:Details.DeliveryInstallationStatus}': 'DeliveryInstallationStatus',
        '${f:Details.Description}': 'Description',
        '${f:Details.Probability}': 'Probability',
        '${f:Details.Amount}': 'Amount',
        '${f:Details.CloseDate}': 'CloseDate'
      }
    }

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

// step, callPlugin, CreateSalesforceRecord
ensure automation AutomateOpportunitySheet
ensure event BeforeInsert
ensure step CreateSalesforceRecord kind: callPlugin 
  executionConditionVar: VarConditionDoesOpportunityRowIdNotMatchAndIdHasValue 
  executionConditionInputPipelineVar: P1 
  targetPlugin: SalesforcePlugin 
  targetPluginApi: CreateOpportunity 
  pluginInputMappingVar: VarMappingOpportunityToCreateOpportunity1 
  pluginOutputMappingVar: VarMappingCreatedRecordIdToOpportunity

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. UpdateEvent step
ensure var VarMappingOpportunityToCreateOpportunity2 kind: mapping 
  deploy: fixedOnDeploy 
  fromForm: EntityOpportunity 
  toPlugin: SalesforcePlugin 
  toForm: CreateOpportunity 
  fieldMappingMap: {
      'map': {
        '${f:Details.Id}': 'Id',
        '${f:Details.Name}': 'OpportunityName',
        '${f:Details.AccountName}': 'AccountName',
        '${f:Details.Type}': 'Type',
        '${f:Details.LeadSource}': 'LeadSource',
        '${f:Details.Stage}': 'Stage',
        '${f:Details.OrderNumber}': 'OrderNumber',
        '${f:Details.CurrentGenerator}': 'CurrentGenerator',
        '${f:Details.TrackingNumber}': 'TrackingNumber',
        '${f:Details.MainCompetitors}': 'MainCompetitors',
        '${f:Details.DeliveryInstallationStatus}': 'DeliveryInstallationStatus',
        '${f:Details.Description}': 'Description',
        '${f:Details.Probability}': 'Probability',
        '${f:Details.Amount}': 'Amount',
        '${f:Details.CloseDate}': 'CloseDate'
      }
    }
// step, callPlugin, UpdateEventInSalesforce
ensure automation AutomateOpportunitySheet
ensure event AfterUpdate
ensure step UpdateEventInSalesforce kind: callPlugin 
  targetPlugin: SalesforcePlugin 
  targetPluginApi: UpdateOpportunity 
  pluginInputMappingVar: VarMappingOpportunityToCreateOpportunity2

d. BeforeRemove event

// event, BeforeRemove
ensure event BeforeRemove fire: beforeRemove
i. RemoveRecord step
ensure var VarMappingOpportunityToRecordIdInputForm2 kind: mapping 
  deploy: fixedOnDeploy 
  fromForm: EntityOpportunity 
  toPlugin: SalesforcePlugin 
  toForm: RecordIdInputForm 
  fieldMappingMap: {
      'map': {
        '${f:Details.Id}': 'Id'
      }
    }

// step, callPlugin, RemoveRecordFromSalesforce
ensure automation AutomateOpportunitySheet
ensure event BeforeRemove
ensure step RemoveRecordFromSalesforce kind: callPlugin 
  targetPlugin: SalesforcePlugin 
  targetPluginApi: RemoveRecord 
  pluginInputMappingVar: VarMappingOpportunityToRecordIdInputForm2

2. AutomateOppWebhook

ensure automation AutomateSalesforcePluginOpportunityDetailWebhook kind: pluginWebhook 
  plugIn: SalesforcePlugin 
  pluginApi: OpportunityDetailWebhook

a. OnCallback event

ensure event OnCallback fire: onCallback

ensure pipelineVar PipelineRowExist form: PrivateRowIdResult
ensure pipelineVar PipelineOpportunity form: EntityOpportunity

i. CopyOpportunity step

ensure var VarMappingOpportunityDetailToOpportunity kind: mapping 
  deploy: fixedOnDeploy
  fromPlugin: SalesforcePlugin 
  fromForm: OpportunityDetail 
  toForm: EntityOpportunity 
  fieldMappingMap: {
      'map': {
        '${f:Details.Id}': 'Details.Id',
        '${f:Details.OpportunityName}': 'Details.Name',
        '${f:Details.AccountName}': 'Details.AccountName',
        '${f:Details.LeadSource}': 'Details.LeadSource',
        '${f:Details.Amount}': 'Details.Amount',
        '${f:Details.Type}': 'Details.Type',
        '${f:Details.Stage}': 'Details.Stage',
        '${f:Details.Probability}': 'Details.Probability',
        '${f:Details.OrderNumber}': 'Details.OrderNumber',
        '${f:Details.CurrentGenerator}': 'Details.CurrentGenerator',
        '${f:Details.TrackingNumber}': 'Details.TrackingNumber',
        '${f:Details.MainCompetitors}': 'Details.MainCompetitors',
        '${f:Details.DeliveryInstallationStatus}': 'Details.DeliveryInstallationStatus',
        '${f:Details.Description}': 'Details.Description',
        '${f:Details.CloseDate}': 'Details.CloseDate'
      }
    }

ensure automation AutomateSalesforcePluginOpportunityDetailWebhook
ensure event OnCallback
ensure step CopyOpportunityDetailToPipeline kind: copyField 
  targetPipelineVar: PipelineOpportunity 
  mappingVar: VarMappingOpportunityDetailToOpportunity

ii. GetRows step

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

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

// step, getSpreadsheetRows, GetSpreadsheetRows
ensure automation AutomateSalesforcePluginOpportunityDetailWebhook
ensure event OnCallback
ensure step GetSpreadsheetRows kind: getSpreadsheetRows 
  targetSpreadsheet: OpportunitySheet 
  targetSpreadsheetFilterVar: VarConditionDoesOpportunityIdMatchExisting2 
  inputFormPipelineVar: PipelineOpportunity 
  outputFormPipelineVar: PipelineRowExist 
  targetToSourceMappingVar: VarMappingOpportunityToPrivateRowIdResult

iii. CopyRowId step

// step, copyField, CopyRowIdToPipeline
ensure step CopyRowIdToPipeline kind: copyField 
  sourcePipelineVar: PipelineRowExist 
  targetPipelineVar: PipelineOpportunity 
  mappingVar: VarMappingPrivateRowIdResultToOpportunity

iv. UpdateSheet step

ensure var VarMappingOpportunityToOpportunity 
  fromForm: EntityOpportunity 
  toForm: EntityOpportunity 
  fieldMappingMap: {
      'map': {
        '${f:Details.Name}': 'Details.Name',
        '${f:Details.AccountName}': 'Details.AccountName',
        '${f:Details.LeadSource}': 'Details.LeadSource',
        '${f:Details.Amount}': 'Details.Amount',
        '${f:Details.Type}': 'Details.Type',
        '${f:Details.Stage}': 'Details.Stage',
        '${f:Details.Probability}': 'Details.Probability',
        '${f:Details.OrderNumber}': 'Details.OrderNumber',
        '${f:Details.CurrentGenerator}': 'Details.CurrentGenerator',
        '${f:Details.TrackingNumber}': 'Details.TrackingNumber',
        '${f:Details.MainCompetitors}': 'Details.MainCompetitors',
        '${f:Details.DeliveryInstallationStatus}': 'Details.DeliveryInstallationStatus',
        '${f:Details.Description}': 'Details.Description',
        '${f:Details.CloseDate}': 'Details.CloseDate'
      }
    }

// step, updateSpreadsheet, UpdateSpreadsheetOpportunitySheet
ensure automation AutomateSalesforcePluginOpportunityDetailWebhook
ensure event OnCallback
ensure step UpdateSpreadsheetOpportunitySheet kind: updateSpreadsheet 
  executionConditionInputPipelineVar: PipelineRowExist 
  targetSpreadsheet: OpportunitySheet 
  inputFormPipelineVar: PipelineOpportunity 
  rowIdField: Other.RowId 
  sourceToTargetMappingVar: VarMappingOpportunityToOpportunity