📁 Docs
Automate it

Add automation

Key pain points

  1. Automate the chore of forwarding invoice to all the customers at the end of the month on WhatsApp | Email | SMS.
  2. Send reminders about payment if the payment is not received within some duration.
  3. Make customer inactive after two reminders and stop tea delivery.
  4. For customers whose payments are received update the accounting software.

Backend

1. Spreadsheets

a. InvoiceTriggerQueue

• Create form
ensure form FormInvoiceTrigger
update form FormInvoiceTrigger label:"Trigger bulk invoice"
 
//** section Details
 
ensure Section Details
 
ensure field DateRange type:"dateRange"
update field DateRange fromDefaultVarId:"startOfMonth" toDefaultVarId:"endOfMonth"
update field DateRange required:"yes"
 
//** grid OfficeSet
 
ensure Grid OfficeSet
ensure gridPermission default:"hide"
 
ensure field OfficeRowId type:"rowId"
ensure field Date type:"date"
ensure field Name type:"text"
ensure field MobileNumber type:"mobileNumber"
ensure field DateRange type:"dateRange"
• Associate form
ensure spreadsheet InvoiceTriggerQueue form:"FormInvoiceTrigger"
 
ensure SpreadsheetPermission insertRoles:"Owner"
ensure SpreadsheetPermission readRoles:"Owner"

b. InvoiceLinkSheet

• Create form
ensure form FormInvoiceLink
 
ensure Section Details
 
ensure field OfficeRowId type:"rowId"
ensure field DateRange type:"dateRange"
ensure field OfficeName type:"text"
ensure field MobileNumber type:"mobileNumber"
ensure field Deeplink type:"hyperlink"
• Associate form
ensure spreadsheet InvoiceLinkSheet form:"FormInvoiceLink"
 
ensure spreadsheetPermission readRoles:"Owner"
ensure spreadsheetPermission updateRoles:"Owner"
ensure spreadsheetPermission removeRoles:"Owner"
• Associate table layout
ensure spreadsheetLayout TableLayout kind:"table"
 
update spreadsheetLayout TableLayout showFields:"DateRange,OfficeName,MobileNumber,Deeplink"
update spreadsheetLayout TableLayout columnSizes:"AutoSize"

2. Automation

a. InvoiceTriggerQueue

// create a mapping variable to map FormOfficeActiveSet.OfficeSet > FormInvoiceTrigger.OfficeSet
ensure variable VarMappingAutomateInvoiceTriggerQueue1 kind:"mapping"
update variable VarMappingAutomateInvoiceTriggerQueue1 description:"FormOfficeActiveSet.OfficeSet > FormInvoiceTrigger.OfficeSet"
update variable VarMappingAutomateInvoiceTriggerQueue1 fromForm:"FormOfficeActiveSet" fromGrid:"OfficeSet" toForm:"FormInvoiceTrigger" toGrid:"OfficeSet"
ensure variableMappingGrid fromGridKey:"OfficeName" toGridKey:"Name"
ensure variableMappingField fromField:"OfficeRowId" to:"OfficeRowId"
ensure variableMappingField fromField:"Date" to:"Date"
ensure variableMappingField fromField:"OfficeName" to:"Name"
ensure variableMappingField fromField:"MobileNumber" to:"MobileNumber"
 
// create a mapping variable to map FormInvoiceTrigger.OfficeSet > FormInvoiceSet
ensure variable VarMappingAutomateInvoiceTriggerQueue2 kind:"mapping"
update variable VarMappingAutomateInvoiceTriggerQueue2 description:"FormInvoiceTrigger.OfficeSet > FormInvoiceSet"
update variable VarMappingAutomateInvoiceTriggerQueue2 fromForm:"FormInvoiceTrigger" fromGrid:"OfficeSet" toForm:"FormInvoiceLink"
ensure variableMappingField fromField:"OfficeRowId" to:"OfficeRowId"
ensure variableMappingField fromField:"DateRange" to:"DateRange"
ensure variableMappingField fromField:"Name" to:"OfficeName"
ensure variableMappingField fromField:"MobileNumber" to:"MobileNumber"
// ensure automation AutomateInvoiceTriggerQueue
ensure automation AutomateInvoiceTriggerQueue kind:"spreadsheet" spreadsheet:"InvoiceTriggerQueue"
 
//ensure automationEvent PrepareInvoiceTriggerOfficeSet
ensure automationEvent PrepareInvoiceTriggerOfficeSet type:"beforeInsert"
 
//ensure automationStep
ensure automationStep SetOfficeSetWithActiveOfficeSet kind:"callReport"
update automationStep SetOfficeSetWithActiveOfficeSet targetReport:"ReportActiveOffice"
update automationStep SetOfficeSetWithActiveOfficeSet reportOutputMapping:"VarMappingAutomateInvoiceTriggerQueue1"
 
ensure automationStep SetOfficeSetDateRangeField kind:"updateField"
update automationStep SetOfficeSetDateRangeField assignValueField:"OfficeSet.DateRange" value:"Field:DateRange"
 
//ensure automationEvent PushInvoiceTrigger
ensure automationEvent PushInvoiceTrigger type:"afterInsert"
 
//ensure automationStep
ensure automationStep ExecuteInvoiceTrigger kind:"gridRowInsertIntoSpreadsheet"
update automationStep ExecuteInvoiceTrigger sourceGrid:"OfficeSet"
update automationStep ExecuteInvoiceTrigger targetSpreadsheet:"InvoiceLinkSheet"
update automationStep ExecuteInvoiceTrigger sourceToTargetMapping:"VarMappingAutomateInvoiceTriggerQueue2"
 
ensure automationStep PopInvoiceTrigger kind:"removeRow"

b. InvoiceLinkSheet

// create a mapping variable to map FormInvoiceLink > FormInvoiceFilter
ensure variable VarMappingAutomateInvoiceLinkSheet kind:"mapping"
update variable VarMappingAutomateInvoiceLinkSheet description:"FormInvoiceLink > FormInvoiceFilter"
update variable VarMappingAutomateInvoiceLinkSheet fromForm:"FormInvoiceLink" toForm:"FormInvoiceFilter"
ensure variableMappingField fromField:"OfficeRowId" to:"OfficeMasterRowId"
ensure variableMappingField fromField:"DateRange" to:"DateRange"
ensure variableMappingField fromField:"OfficeName" to:"Name"
// ensure automation AutomateInvoiceLinkSheet
ensure automation AutomateInvoiceLinkSheet kind:"spreadsheet" spreadsheet:"InvoiceLinkSheet"
 
//ensure automationEvent SetDeeplinkField
ensure automationEvent SetDeeplinkField type:"beforeInsert"
 
//ensure automationStep
ensure automationStep InvokeDlOfficeInvoice kind:"generateDeeplink"
update automationStep InvokeDlOfficeInvoice deeplinkField:"Deeplink" deeplink:"DlOfficeInvoice"
update automationStep InvokeDlOfficeInvoice reportInputFormMappingVar:"VarMappingAutomateInvoiceLinkSheet"

Frontend

Actions

a. PushInvoiceTrigger

ensure action PushInvoiceTrigger kind:"rowInsert"
 
update Action PushInvoiceTrigger spreadsheet:"InvoiceTriggerQueue"
update action PushInvoiceTrigger icon:"SendToMobileRounded"
update Action PushInvoiceTrigger sendMessageToInbox:"yes"

b. InvoiceLinkSheet

ensure action InvoiceLinkSheet kind:"spreadsheetEditor"
 
update Action InvoiceLinkSheet spreadsheet:"InvoiceLinkSheet"
update Action InvoiceLinkSheet spreadsheetLayout:"TableLayout"
update action InvoiceLinkSheet icon:"MenuRounded"

Associate actions

goto group Reporting
 
ensure groupAction action:"PushInvoiceTrigger" roles:"Owner" menuGroup:"Automation" deviceSizes:"mobile,desktop"
ensure groupAction action:"InvoiceLinkSheet" roles:"Owner" menuGroup:"Automation" deviceSizes:"mobile,desktop"

Deploy

// Deploy the enterprise
deploy enterprise