Understanding Actions (the Then Clause)

The right side of the script control (to the right of the caret) tells Civic Platform what to do if the criteria evaluates to true. In most cases the action portion calls a master script function to perform an action (Master Script Function List).

To execute multiple actions, you can write your script controls two ways; 1) list each action separated by a semicolon (;) on the same line (Table 1), or 2) put each action on a different line (Table 2).

Table 1. Multiple Actions on Same Line
# Value Description
01 {Review Required} == “Yes” ^ addFee(“REVIEWFEE”,”FEESCHEDULE”,”FINAL”,1,”Y”); scheduleInspection(“Special Review Inspection”,1); //any additional action…

When you put multiple actions on different lines, start each new line with a caret (^).

Table 2. Multiple Actions on Different Lines
# Value Description
01 {Review Required} == “Yes” ^ addFee(“REVIEWFEE”,”FEESCHEDULE”,”FINAL”,1,”Y”) ;
02 ^ scheduleInspection(“Special Review Inspection”,1);
03 ^ //any additional needs for the action…

Best practice recommends the multiple line approach due to width limitations for Standard Choice item entries.

To maintain consistency, best practice recommends the use of semicolons at the end of each line, even for single action script controls (Table 3).

Table 3. Single Action Script Controls with Semicolons
Action Description
activateTask(“Plan Review”); Activates the workflow task on the current record specified by the first parameter.
addAppCondition(“Permit”,”Applied”,”Re-Inspection Fee”,”Re-Inspection Fee”,”Hold”); Applies a hold condition to the current record with the specific type, name, and description.
childApp = createChild(“Building”,”Commercial”,”Plumbing”,”NA”,”New Walmart”); Creates a child record for the Building/Commercial/Plumbing/NA record type instance named New Walmart.
editAppSpecific(“Total Value”,parseInt({Sq Ft}) * parseInt({Price per Sq Ft})); Updates the ASI field Total Value to the product of the ASI fields {Sq Ft} and {Price per Sq Ft}.