Bookshelf Home | Contents | Index | Search | PDF |
Siebel eScript Language Reference > Siebel eScript Language Overview > 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.
Syntax
with (object)
{
method1;
method2;
.
.
.
methodn;
}
Placeholder Description object An object with which you wish to use multiple methods method1, method2, methodn Methods to be executed with the objectReturns
Not applicable
Usage
The with statement is used to save time when working with objects. It prepends 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.
Example
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)
{
SetViewMode(SalesRepView);
ActivateField( "Sales Stage" );
SetSearchSpec("Id", srowid);
ExecuteQuery(ForwardOnly);
}
bcOppty = null;
boBusObj = null;The portion in the with block is equivalent to:
bcOppty.SetViewMode(SalesRepView);
bcOppty.ActivateField( "Sales Stage" );
bcOppty.SetSearchSpec("Id", srowid);
bcOppty.ExecuteQuery(ForwardOnly);
Bookshelf Home | Contents | Index | Search | PDF |
Siebel eScript Language Reference Published: 18 April 2003 |