Siebel Tools > A simple search example with eScript in Siebel Tools
A simple search example with eScript in Siebel Tools
We will search activities.
The user will send an Activity Id and we will display 3 fields based on this: Activity Account Name, Activity Account ID and Activity UID.
First check out Project 'Activity'. Open Business Component Action -> Click on 'Edit Server Scripts' and go to section
'BusComp_PreInvokeMethod'
here add these lines to function BusComp_PreInvokeMethod (MethodName).
function BusComp_PreInvokeMethod (MethodName)
{
case "SearchActivity":
this.SearchActivity(this.GetFieldValue("Id"));
return (CancelOperation);
}
The first line will accept the Activity ID to search. The second line 'return (CancelOperation);' is recommended.
Then create a function called SearchActivity.
You need to click on (general) and type 'function SearchActivity (FieldName, FieldValue)'
Siebel Tools will automatically create a function section.
Then write this code in the function:
function SearchActivity (FieldName, FieldValue) var boBusObj = TheApplication().GetBusObject("Action"); /*this activates the Business Object for Activity , which is Action */ var bcOppty = boBusObj.GetBusComp("Action"); /*this activates the Business Component for Activity , which is Action */ var rowId = GetFieldValue("Id"); //accept the input Activity ID with (bcOppty) /* this means we do not have to keep typing bcOppty. Otherwise we would have to type bcOppty.SetViewMode;, bcOppty.ActivateField("Account Name"); and so on. */ { SetViewMode(AllView); //This gives access to data from all Organisations ActivateField("Account Name"); //Get the Account Name ActivateField(“Account Id”); //Get the Account Id ActivateField(“Activity UID”); //Get the Activity UID SetSearchSpec("Id", rowId); // Search based on input ID = Activity rowID ExecuteQuery(ForwardOnly); //We do not need to go back to row 1, better for performance } bcOppty = null; boBusObj = null; }
|