Sample Code of Finding a Contact
The following Siebel VB and Siebel eScript code samples look for the current caller in the database.
Sample VB Code
Sub Script_Open
Dim FirstQuestion as SmartScriptQuestion
Dim ContactBC as BusComp
Dim ContactId as String
Dim ContactExists as Integer
Set FirstQuestion = StartQuestion
Set ContactBC = FirstQuestion.GetSaveBusComp
ContactBC.ActivateField "Id "
ContactId = GetParameter("ContactId")
If ContactId <> "" then
ContactBC.SetViewMode 3
ContactBC.SetSearchSpec "Id", ContactId
ContactBC.ExecuteQuery ForwardBackward
ContactExists = ContactBC.FirstRecord()
If not ContactExists then
ContactBC.NewRecord NewBefore
end if
else
ContactBC.NewRecord NewBefore
end if
End Sub
Sample eScript Code
function Script_Open ()
{
var FirstQuestion;
var ContactBC;
var ContactId;
var ContactExists;
FirstQuestion = StartQuestion ();
ContactBC = FirstQuestion.GetSaveBusComp ();
ContactBC.ActivateField ("Id");
ContactId = GetParameter ("ContactId");
if (ContactId != "")
{
ContactBC.SetViewMode (3);
ContactBC.SetSearchSpec ("Id", ContactId);
ContactBC.ExecuteQuery (ForwardBackward);
ContactExists = ContactBC.FirstRecord ();
if (!ContactExists)
{
ContactBC.NewRecord (NewBefore);
}
}
else
{
ContactBC.NewRecord (NewBefore);
}
}