Automation Block
What is Automation Block?
Automation Block is a UI feature that automates tasks within or across modules. Using the automation block, the data can be updated automatically. This is done to minimize manual update of relevant records.
4 Block Tools:
- Actions → process of doing something automatically
- Condition → check/compares the value
- For → used to repeat a specific block of code a known number of times
- Trigger → trigger when something changes
7 Basic Element under Actions:
- Perform → Submit an activity
- Find → Find an entry that meets the condition
- Find All → Find more than one entry that meets the condition
- Form → Retrieve a form
- Error → Display error message to end user
- Create → Create a new Variable
- Set → Set Value to a Variable
Components:
- Form → information within the form
Show only the information in the from
- Entry → Show list of information from the Module
- CURRENT USER → system captures login user
- TODAY → current date
- NOW → current date and time
- If…else… → to execute both the true part and the false part of a given condition. If the condition is true, the if block code is executed and if the condition is false, the else block code is executed.
If (condition):
#Executes this block if the condition is true
else:
#Executes this block if the condition is false
- Or → Logical operator that evaluates as True if any of the operands is True
- and → Logical operator that returns True if both the operands are true
- condition → compares the value or equality of two objects
For e.g.
- sum (list / table) → the total amount or number
- filter (list / table) → filter information that meets the condition
- find (list / table) → find an information that meets the condition
- addRow (table) → add table row with values
- removeRow (table) → remove specific table row
- sort (list / table) → sort information by ascending or descending order
- group (list /table) → group the information
Before executing
- Set Value within the form
- Perform Activity at another Module
Block - Perform Activity at another Module using Before Submission - Prompt Alert Message
Block - Prompt Error Message Before Submission
After executing
- Perform Activity to another Module
Block - Perform Activity at another Module using Before Submission
Sample Scenario
Scenario: To trace the record of money that has moved in and out of your account.
Setup Modules
Module 1: Transfer In → get fund into the account
Module 2: Transfer Out → get fund out from the account
Module 3: Transaction → trace the movement of the funds
Automation for Transfer In
- Go to Module 1: Transfer In > Basic (Create) > New Automation > Do after
Note:
Type = Type of Transaction(Transfer In)
Before Amount = The opening/balance amount (Opening amount)
Debit Amount = Amount that Transfer In
Current Amount = The Latest Amount (Before + Debit)
When performing Create do Automation
- Do after
- Select Find All under Action Tool
- Select ‘Module’: Transaction
Find the Transaction Module first to get the current amount - Click OK
- Condition Tool
- Type #Transaction List Found
to indicate if the transaction is not None
If True:
- Select Create under Action Tool
Variable:findLatest → find the latest balance amount
Value: sort(#Transaction List Found #Document ID, ‘descending’)[0] → sort by Document ID to get the latest Transaction. [0] → take the first row value
- Click + Add Action
- Select Perform
- Select Module:Transaction
Select Activity: Create
Click Expand Property
Select Before Amount: #findLatest #Current Amount
Pass the opening/balance amount from the account
Select Type: ‘Transfer In’
To indicate the transaction is from Transfer In
Select Debit Amount: #Entry #Amount
Select Current Amount: #findLatest #Current Amount + #Entry #Amount
Select Reference No.: #Entry #Reference No
If False:
- Select Perform
- Select Module: Transaction
Select Activity: Create
Click Expand Property
Select Before Amount: 0
No transaction from this account
Select Type: ‘Transfer In’
Select Debit Amount: #Entry #Amount
Amount that Transfer In
Select Current Amount: #Entry #Amount
Select Reference No.: #Entry #Reference No
13. Click OK
14. Click Save
Result for Transfer In
Automation for Transfer Out
- Go to Module 2: Transfer Out > Basic (Create) > New Automation > Do after
Note:
Type = Type of Transaction (Transfer Out)
Before Amount = The previous balance amount
Credit Amount = Amount that Transfer Out
Current Amount = The Latest Amount (Before - Debit)
When executing Create do Automation
- Do after
- Select Find All under Action Tool
- Select ‘Module’: Transaction
Find the Transaction Module first to get the current amount - Click OK
- Condition Tool
- Type #Transaction List Found
to indicate if the transaction is None
If True:
- Select Create under Action Tool
Variable:findLatest
Value: sort(#Transaction List Found #Document ID, ‘descending’)[0] → sort by Document ID to get the latest Transaction. [0] → take the first row value
- Click + Add Action
- Select Perform
- Select **Module:**Transaction
- Select Activity: Create
Click Expand Property
Select Before Amount: #findLatest #Current Amount
Pass the opening/balance amount from the account
Select Type: ‘Transfer Out’
To indicate the transaction is from Transfer Out
Select Credit Amount: #Entry #Amount
Select Current Amount: #findLatest #Current Amount - #Entry #Amount
Select Reference No.: #Entry #Reference No
6. Click OK
7. Click Save
Result for Transfer Out
Alert for Account is insufficient or not found
- Go to Module 2: Transfer Out > Basic (Create) > Automation > Do before
When executing Create do Automation
- Do before
- Select Find All under Action Tool
- Select ‘Module’: Transaction
Filter:
- Click + add condition
- Select Current Amount greater than or equal min 1
- Click OK
- Condition Tool
- Type #Transaction List Found → to indicate if the transaction is not None
If False:
- Select Error under Action Tool
Type: ‘Insufficient Amount’
- Click OK
- Click Save
Result for Alert