Siebel eScript Language Reference > Using Siebel eScript > Guidelines for Using Siebel eScript >

Use Expressions, Statements, and Statement Blocks


An expression includes two or more terms that perform a mathematical or logical operation. These terms are typically variables or functions that you can use with an operator to produce a string or numeric result. You can write code that uses an expression to configure Siebel eScript to do the following work:

  • Perform a calculation.
  • Manipulate a variable.
  • Concatenate a string.

The following example statement includes an expression. It computes a sum and saves it in a variable:

var TestSum = 4 + 3

Note the following:

  • Siebel CRM runs Siebel eScript code one statement at a time from the beginning of the code to end of the code.
  • You can use a semicolon at the end of a statement, although Siebel eScript does not require this format.
  • To make your script easier to read and edit, it is recommended that you write each statement on a separate line, with or without a semicolon.
  • A statement block is a group of statements that Siebel eScript treats as one statement. You use curly brackets ({}) to enclose a statement block. To simplify reading, it is recommended that you indent the statements in a statement block.

Running Statements In a Loop

A While statement is a type of statement that causes Siebel eScript to run the statement that occurs immediately after the While statement in a loop. If you enclose multiple statements in curly brackets, then Siebel eScript treats them as one statement and runs them in the loop. The following example includes this usage:

while( ThereAreUncalledNamesOnTheList() == true)
{
   var name = GetNameFromTheList();
   CallthePerson(name);
   LeaveTheMessage();
}

Siebel eScript treats the three lines that occur after the While statement as one unit. The brackets cause Siebel eScript to run the script through each line until it calls every name that resides in the list. If you remove these brackets, then it does the following:

  • Runs the loop only for the first line.
  • Processes the names on the list but only calls the last name.
Siebel eScript Language Reference Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Legal Notices.