trace
prints the zero or more comma-separated parameters that you pass it
to the audit log. Administrator- and Developer-level users can access the audit log on the
Backoffice site on the Dev
console>Log screen. To display a
trace message, click on the more button in the
Info column of a workflow script entry on the log
screen.
Block statement
Use curly braces {}
to group zero or more statements together into a
block. The statements inside a block will be executed in sequential order.
Note that curly braces can also instantiate map literals.
The workflow script language is lexically scoped, and a block defines a scoping boundary. Variables that you declare inside a block will be accessible only inside the originating block and its nested blocks, but not outside it.
The body of a workflow script must be a single block of statements.
The statements inside a block need to be separated by semi-colons
(;
).
Value assignment
Use the assignment operator - a single equal sign (=
) - to set the value
stored in a new or existing variable, assign a new value to a key in a map or an item in a list.
Using the foreach
statement, you can start a loop to iterate over items in
a list
,
and execute a specific statement on each of them.
Parameter | Description |
---|---|
iterator-name (required) | The name of the iterator variable for the loop. |
list-name (required) | Name of the list that the loop iterates over. |
statement-to-execute (required) | The statement or block of statements to execute for each item in the loop. |
Using the for
statement, you can start a loop that executes a statement
until a preset condition is met.
Parameter | Description |
---|---|
iterator-initialization (required) | A variable assignment expression to declare and initilaize a counter variable for the loop. |
condition (required) | A bool
value expression that is evaluated before each loop iteration. The statement parameter
is executed only if it evaluates to true .
|
iterator-statement (required) | A statement evaluated at the end of each loop iteration. |
loop-body (required) | A statement or block of statements that is executed in each iteration as long as
the condition parameter evaluates to true .
|
The sample below will trace the numbers from 1 to 10 to the console.
Both of these statements are allowed only inside for
and foreach
statements.
When the execution environment hits the continue
statement in a loop
statement, it stops the execution of the statements in the loop's current iteration, and
continues with the loop's next
iteration.
"Your number is ", 1 "Your number is ", 2 "Your number is ", 4 "Your number is ", 5 "Your number is ", 6 "Your number is ", 7 "Your number is ", 8 "Your number is ", 9 "Your number is ", 10
Figure 307. The loop ignores the iteration where the continue
condition is
met
When the execution environment hits the break
statement in a loop
statement, it stops the execution of the loop's current iteration, and skips any further
iterations. Execution continues with the first statement after the
loop.
Figure 308. The loop ignores every iteration including and after the one where the
break
condition is met
Use the if
statement to have a specific statement execute only if a preset
condition is met. You can have a second statement be executed if the preset condition
evaluates to false
, or set up a series of conditions and associate a
different statement with each one.
The sample below will trace an exclamation only if the user enters a number below 5 in the
myNumber
numberbox.
The script below will trace a different string to the console if the earlier condition is not met.
The script below will trace one of three statements to the console depending on the user input.