Siebel eScript Language Reference > Siebel eScript Language Overview > Siebel eScript Statements >

with Statement

The with statement assigns a default object to a statement block, so you need to use the object name with its properties and methods.


with (object)



An object with which you wish to use multiple methods

method1, method2, methodn

Methods to be executed with the object


The with statement is used to save time when working with objects. It prefixes the object name and a period to each method used.

If you were to jump from within a with statement to another part of a script, the with statement would no longer apply. The with statement only applies to the code within its own block, regardless of how the Siebel eScript interpreter accesses or leaves the block.

You may not use a goto statement or label to jump into or out of the middle of a with statement block.


The following fragment illustrates the use of the with statement:

var bcOppty;
var boBusObj;
boBusObj = TheApplication().GetBusObject("Opportunity");
bcOppty = boBusObj.GetBusComp("Opportunity");
var srowid = bcOppty.GetFieldValue("Id");

   with (bcOppty)
      ActivateField("Sales Stage");
      SetSearchSpec("Id", srowid);
   boBusObj = null;
   bcOppty = null;

The portion in the with block is equivalent to:

bcOppty.ActivateField("Sales Stage");
bcOppty.SetSearchSpec("Id", srowid);

Siebel eScript Language Reference