The Musings of Chin - SmartSimple's Order of Operations
Chin's latest Musing goes behind the screen to reveal the processes that ensure your system runs without errors.
Let's learn about SmartSimple's Order of Operations!
It is crucial that everyone fully understands the fundamentals of which processes happen and in what order when using the system. Not understanding this order will lead to logical errors and sometimes uncertain behaviour (consider the importance of mathematical order of operations!).
As seen below, it is extremely dangerous to do any scripting as any scripting errors that are introduced through configuration could result in breaking a lot of base system functionality. Let's take a look at how a Level 3 works.
Opening an L3
1) The Variable Processor runs over the entire page multiple times in the below order. This process happens server side before the page even reaches the user's browser. When we expect a high user load we must carefully consider how we use the Variable Processor for performance considerations.
- Variable Processor replaces @System.@ variables
- Variable Processor replaces @me.@ variables
- Variable Processor replaces @rootcompany.@ variables
- Variable Processor replaces @ReportProperty()@ variables
- Variable Processor replaces prefixed @parent.@ @client.@ @owner.@ @branch.@ ...etc. variables
- Variable Processor replaces @standardfields@ @customfields@ variables
- Variable Processor replaces @xml.customfield@ variables
- Variable Processor replaces [#(?object=)#] list view queries
- Variable Processor replaces @System2.@ variables
- Variable Processor replaces @sslogic and @sscalculation calculations
- Variable Processor replaces @ReportProperty2()@ variables
- Variable Processor replaces @ssencrypt @ssescape and @sstranslate variables
2) The page is then sent to the end-user's browser.
3) Script - _showhideheader(); calls are run and initiates which title bars show/hide, as well as dynamic control fields.
4) Script - onloadfunc(); runs after all the page elements are completely loaded.
5) Script - SystemCall onload(); the script function is initialized and called here, however the actual processing occurs asynchronously server side.
Saving an L3
6) Script - savefunc(); runs on save draft, save, or submit.
7) Script - sbfunc(); runs on save, or submit.
8) Script - various system functions such as sanitizing and converting all dates/input values into appropriate values to be stored to the database.
9) The page is then submitted and posted to the server.
After an L3 Has Been Saved
The following processes run unseen in the background after all the L3 fields have been saved and updated.
10) Script - SystemCall onsave(); the script function was actually initialized and called before step (9), but this is where the actual processing occurs and runs server side.
11) Submit Logic - this checks the conditions and custom field values based on the saved field values.
12) Template Formulas - template formulas run based on the saved field values in this order:
- L3 global formula
- L3 type formula
- L2 global formula
- L2 type formula
- L1 global formula
- L1 type formula
13) Workflows - workflows based on status are then triggered.