📁 Showcase
Automation

Automation

Backend

1. Automation

a. AutomateQuikBookSheet

ensure automation AutomateTransactionSheet
  kind: spreadsheet 
  modules: ["QuickBooks"] 
  spreadsheet: TransactionSheet

b.BeforeInsert event

ensure event BeforeInsert fire: beforeInsert

c.CopyRowId step

ensure var VarMappingTransactionToTransaction kind: mapping 
  modules: ["QuickBooks"] 
  deploy: fixedOnDeploy
fromForm: EntityTransaction 
  toForm: EntityTransaction 
  fieldMappingMap: {
      'updateVariant': 'updateForced',
      'emptyVariant': 'ignoreEmptyField',
      'map': {
        '${f:SysRowId}': 'Details.TransactionRowId'
      }
    }

ensure automation AutomateTransactionSheet
ensure event BeforeInsert 
ensure step CopyRowId kind: copyField
  mappingVar: VarMappingTransactionToTransaction

d.GetSpreadsheetRows step

ensure var VarMappingNetAssetsToTransaction kind: mapping 
  deploy: fixedOnDeploy
  fromForm: EntityNetAsset
  toForm: EntityTransaction 
  fieldMappingMap: {
      'updateVariant': 'updateForced',
      'emptyVariant': 'ignoreEmptyField',
      'map': {
        '${f:SysRowId}': 'Details.AssetRowId'
      }
    }

ensure automation AutomateTransactionSheet
ensure event BeforeInsert 
ensure step GetSpreadsheetRows kind: getSpreadsheetRows 
  targetSpreadsheet: NetAssetSheet 
  targetToSourceMappingVar: VarMappingNetAssetsToTransaction

e.AfterInsert event

ensure event AfterInsert fire: afterInsert

f.UpdateAssetRemove step

ensure var VarConditionIsTypeDebit kind: condition 
  modules: ["QuickBooks"] 
  deploy: fixedOnDeploy
  value: "<root>
      <stmt>${f:Details.Type} == ${d:Type.keyDebit}</stmt>
    </root>" 
  sourceForm: EntityTransaction

ensure automation AutomateTransactionSheet
ensure event AfterInsert 
ensure step UpdateAssetRemove kind: updateLogNumber 
  executionConditionVar: VarConditionIsTypeDebit 
  operation: subtract 
  value: "${f:Details.TotalAmount}" 
  rowField: Details.AssetRowId 
  targetSpreadsheet: NetAssetSheet 
  targetField: Details.NetAsset

g.UpdateAssetAdd step

ensure var VarConditionIsTypeCredit kind: condition
  modules: ["QuickBooks"] 
  deploy: fixedOnDeploy
  value: "<root>
      <stmt>${f:Details.Type} == ${d:Type.keyCredit}</stmt>
    </root>" 
  sourceForm: EntityTransaction

ensure automation AutomateTransactionSheet
ensure event AfterInsert
ensure step UpdateAssetAdd kind: updateLogNumber 
  executionConditionVar: VarConditionIsTypeCredit 
  operation: add 
  value: "${f:Details.TotalAmount}" 
  rowField: Details.AssetRowId 
  targetSpreadsheet: NetAssetSheet 
  targetField: Details.NetAsset

h.BeforeUpdate event

ensure form PrivatePipelineAmount modules: ["QuickBooks"]
ensure section: Details
ensure field CurrentAmount kind: decimal numberOfDigitsAfterPeriod: 2
ensure field PrevAmount kind: decimal numberOfDigitsAfterPeriod: 2
ensure field AmountDiff kind: decimal numberOfDigitsAfterPeriod: 2
ensure field AssetRowId kind: rowId 

ensure automation AutomateTransactionSheet
ensure event BeforeUpdate fire: beforeUpdate
ensure pipelineVar PipelinePrevAmount form: PrivatePipelineAmount

i.CopyTotalAmount step

ensure var VarMappingTransactionToPipeline2 kind: mapping 
  deploy: fixedOnDeploy
  modules: ["QuickBooks"]
  fromForm: EntityTransaction 
  toForm: PrivatePipelineAmount 
  fieldMappingMap: {
      'updateVariant': 'updateForced',
      'emptyVariant': 'ignoreEmptyField',
      'map': {
        '${f:Details.TotalAmount}': 'Details.CurrentAmount'
      }
    }

ensure automation AutomateTransactionSheet
ensure event BeforeUpdate
ensure step CopyTotalAmount kind: copyField 
  targetPipelineVar: PipelinePrevAmount 
  mappingVar: VarMappingTransactionToPipeline2

j.GetSpreadsheetRows step

ensure var VarConditionCheckTransactionRowId kind: condition
  modules: ["QuickBooks"] 
  deploy: fixedOnDeploy
  value: "<root>
      <stmt>${in:Details.TransactionRowId} == ${f:Details.TransactionRowId}</stmt>
    </root>" 
  sourceForm: EntityTransaction 
  inputForm: EntityTransaction

ensure var VarMappingTransactionToPipeline1 kind: mapping
  modules: ["QuickBooks"] 
  deploy: fixedOnDeploy
  fromForm: EntityTransaction 
  toForm: PrivatePipelineAmount 
  fieldMappingMap: {
      'updateVariant': 'updateForced',
      'emptyVariant': 'ignoreEmptyField',
      'map': {
        '${f:Details.TotalAmount}': 'Details.PrevAmount'
      }
    }

ensure automation AutomateTransactionSheet
ensure event BeforeUpdate
ensure step GetSpreadsheetRows kind: getSpreadsheetRows 
  targetSpreadsheet: TransactionSheet 
  targetSpreadsheetFilterVar: VarConditionCheckTransactionRowId 
  outputFormPipelineVar: PipelinePrevAmount 
  targetToSourceMappingVar: VarMappingTransactionToPipeline1

k.CalculateDebitAmountDiff step

ensure step CalculateDebitAmountDiff kind: calculateFormulas 
  formulaFormPipelineVar: PipelinePrevAmount

// newFormula, AmountDiff
ensure newFormula AmountDiff 
  assignToField: Details.AmountDiff 
  formula: "${f:CurrentAmount} - ${f:PrevAmount}"

l.AfterUpdate event

ensure event AfterUpdate fire: afterUpdate

m.GetNetAssetSpreadsheetRows step

ensure var VarMappingNetAssetsToPipeline kind: mapping 
  deploy: fixedOnDeploy
  fromForm: EntityNetAsset
  toForm: PrivatePipelineAmount 
  fieldMappingMap: {
      'updateVariant': 'updateForced',
      'emptyVariant': 'ignoreEmptyField',
      'map': {
        '${f:SysRowId}': 'Details.AssetRowId'
      }
    }

ensure automation AutomateTransactionSheet
ensure event AfterUpdate
ensure step GetNetAssetSpreadsheetRows kind: getSpreadsheetRows 
  targetSpreadsheet: NetAssetSheet 
  outputFormPipelineVar: PipelinePrevAmount 
  targetToSourceMappingVar: VarMappingNetAssetsToPipeline

n.UpdateAssetRemove step

ensure step UpdateAssetRemove kind: updateLogNumber 
  executionConditionVar: VarConditionIsTypeDebit 
  operation: subtract 
  sourcePipelineVar: PipelinePrevAmount 
  value: "${f:Details.AmountDiff}" 
  rowField: Details.AssetRowId 
  targetSpreadsheet: NetAssetSheet 
  targetField: Details.NetAsset

o.UpdateAssetAdd step

ensure step UpdateAssetAdd kind: updateLogNumber 
  executionConditionVar: VarConditionIsTypeCredit 
  operation: add 
  sourcePipelineVar: PipelinePrevAmount 
  value: "${f:Details.AmountDiff}" 
  rowField: Details.AssetRowId 
  targetSpreadsheet: NetAssetSheet 
  targetField: Details.NetAsset

p.BeforeRemove event

ensure event BeforeRemove fire: beforeRemove

q.UpdateAssetRemove step

ensure step UpdateAssetDebit kind: updateLogNumber 
  executionConditionVar: VarConditionIsTypeDebit 
  operation: add 
  value: "${f:Details.TotalAmount}" 
  rowField: Details.AssetRowId 
  targetSpreadsheet: NetAssetSheet 
  targetField: Details.NetAsset

r.UpdateAssetCredit step

ensure step UpdateAssetCredit kind: updateLogNumber 
  executionConditionVar: VarConditionIsTypeCredit 
  operation: subtract 
  value: "${f:Details.TotalAmount}" 
  rowField: Details.AssetRowId 
  targetSpreadsheet: NetAssetSheet 
  targetField: Details.NetAsset