Configuration syntax in SmartSimple follows specific rules for quoting, casting, and null handling, and each field update method carries different timing, visibility, and complexity tradeoffs within SmartSimple's defined order of operations.
Variable Processor Syntax Rules
The Variable Processor pre-processes and dynamically replaces values throughout the system based on the context of the current user or object being viewed. As a general rule, encapsulate a variable within double quotes whenever it is retrieved for use in a calculation, evaluation, or assignment.
Template Formula
@level1.name@=@level1.owner.firstname@ @level1.owner.lastname@;
When assigning a string value to a custom field, the string must be enclosed in quotes. This example produces a server error and no data is saved.
@level1.name@='@level1.owner.firstname@ @level1.owner.lastname@';
Names containing apostrophes (for example, Chin O'Brien) terminate the single-quoted string, causing a server error.
@level1.name@="@level1.owner.firstname@ @level1.owner.lastname@";
Always use double quotes around strings.
Browser Scripts
frm.cf_@customfield.id@.value="";
When the field value is null, the Variable Processor may not replace the variable, resulting in the literal syntax appearing on the page and disrupting subsequent scripts.
document.getElementById("cf_@customfield.id@");
var oppid=@opportunityid@;When the variable is blank or nonexistent, this script fails and breaks all following scripts.
var oppid="@opportunityid@";
Visibility Conditions
@opportunityid@>0
When creating a new Level 1, the @opportunityid@ is not yet available and is not replaced, causing a server error. This can make the condition appear to work (the field is not visible) while actually failing silently.
"@opportunityid@"*1>0
Report Properties
@ReportProperty(12345,recordcount)@ + @custom number@
If either value is blank or null, this expression fails.
"@ReportProperty(12345,recordcount)@"*1 + "@custom number@"*1
The *1 explicitly casts the result to a numeric value. If the variable contains a non-numeric character, *1 converts it to 0. If it is blank, ""*1 also converts to 0.
- Failing to use quotes within @sslogic() or @sscalculation() conditions produces errors that may not be immediately visible, potentially leading to incorrect assumptions.
- The .inRole variable always returns boolean true or false values; there is no need to encapsulate it in double quotes (for example: @me.inRole(Organization Contact)@).
- When the retrieved variable value contains double quotes, these must be escaped, or the variable must be enclosed in single quotes if the value is certain not to contain single quotes.
Field Update Methods Comparison
SmartSimple provides several methods for storing or updating a field value. The right choice depends on timing, visibility, and complexity requirements.
| Method | Configuration | Advantages |
|---|---|---|
| Default Text | Configured on the custom field settings page for open text input fields, such as Text - Single Line. Pre-populates the input field with a designated value when the field has no stored value. The user must save the form to retain the value. |
|
| Calculated Value Field | Applies only to the Special - Calculated Value custom field type. Configured using JavaScript syntax; populates the input field each time the form loads. The user must save the form to store the value. |
|
| Value Stores To | Configured on the custom field settings page. Duplicates a field value into another field whenever the first field is saved. Requires the user to input a value into the first field. |
|
| Template Formula | Available in UTA/module settings, User Roles, or Company Categories pages. Configured using MySQL syntax. Directly updates the stored value of a field after saving. Executes post-save using the most recently saved field values. |
|
| Workflow Task | Configured as a task within a workflow. The workflow must be triggered against the object whose field requires updating. |
|
SmartSimple Order of Operations
The sequence in which SmartSimple processes scripts, formulas, and data determines correct configuration behavior. Errors in this sequence can cause logical errors and unpredictable behavior. The following describes the operation of a Level 3 record.
Level 3 Record Initiation
The Variable Processor executes over the entire page multiple times in the following order, on the server side before the page reaches the browser:
- Substitutes @System.@ variables.
- Substitutes @me.@ variables.
- Substitutes @rootcompany.@ variables.
- Substitutes @ReportProperty()@ variables.
- Substitutes prefixed variables: @parent.@, @client.@, @owner.@, @branch.@, and similar.
- Substitutes @standardfields@ and @customfields@ variables.
- Substitutes @xml.customfield@ variables.
- Substitutes [#(?object=)#] list view queries.
- Substitutes @System2.@ variables.
- Substitutes @sslogic and @sscalculation calculations.
- Substitutes @ReportProperty2()@ variables.
- Substitutes @ssencrypt, @ssescape, and @sstranslate variables.
After Variable Processor execution:
- The page is dispatched to the end user's browser.
- The _showhideheader() script executes, determining which title bars are displayed or hidden, along with dynamic control fields.
- The onloadfunc() script executes after all page elements are fully loaded.
- The SystemCall onload() initializes and calls the script function; actual processing occurs asynchronously on the server.
Level 3 Record Save Sequence
- The savefunc() script executes upon saving a draft, saving, or submitting.
- The sbfunc() script executes upon saving or submitting.
- Various system functions execute, including sanitizing and converting all dates and input values into formats for database storage.
- The page is submitted and posted to the server.
Post-Save Processes for a Level 3 Record
The following processes execute in the background after all Level 3 fields have been saved:
- SystemCall onsave() was initialized before posting; actual processing executes on the server at this point.
- Submit Logic checks conditions and custom field values based on the saved field values.
- Template Formulas execute in the following order: Level 3 global formula, Level 3 type formula, Level 2 global formula, Level 2 type formula, Level 1 global formula, Level 1 type formula.
- Workflows based on status are triggered.