If, in some cases, the formulas on the sheet are not triggered when the record is created and you want to automatically recalculate them after saving the record, follow the steps in this guide to insert your script.
Step 1: Open the Javascript Workflow Editor
Click the arrow icon next to the sheet name in the tab, and select Javascript Workflow.
Step 2: Switch to Post-workflow
Step 3: Paste and Edit the Following Script, Then Save
var nodeId = param.getNewNodeId(Key Field); var path = '/tab_path/sheet_path'; var query = db.getAPIQuery(path); var entry = query.getAPIEntry(nodeId); entry.recalculateAllFormulas(); entry.setIfDoLnls(true); entry.setCreateHistory(true); entry.save();
Edit Points:
1. Replace the Key Field with the Key Field ID of the sheet.
You can find this ID in the Javascript Workflow Editor (under Pre-workflow) or by referring to the Data Dictionary.
For example, if the key field ID is 2000906, update the script as follows:
var nodeId = param.getNewNodeId(2000906);
2. Replace '/tab_path/sheet_path' with your own tab and sheet path.
For example, if your sheet URL is:
www.ragic.com/sample/sales/3?PAGEID=wSM (ignore the ?PAGEID=wSM part),
then update the script as follows:
var path = '/sales/3';
3. To recalculate the formulas of specific fields instead of all fields, you can replace the following line:
entry.recalculateAllFormulas();
with
entry.recalculateFormula(field id);
For example, to recalculate formulas for three specific fields (Field IDs: 1000001, 1000002, 1000003), enter each Field ID separately. Since each field requires a separate line, you would write:
entry.recalculateFormula(1000001); entry.recalculateFormula(1000002); entry.recalculateFormula(1000003);