Siebel SmartScript Administration Guide > Extending Scripts with Siebel VB and Siebel eScript > Siebel VB and Siebel eScript Sample Code >
Sample Code of Complex Branching
The following sample code demonstrates complex branching, setting branching activity (and the answer to a question), based on whether a contact existed or a new one was created. For sample code that demonstrates data acquisition and database querying, see Sample Code of Finding a Contact. Siebel VB Code
Function Question_PreBranch (Answer As String) As Integer
Dim ContactBC as BusComp Dim ContactExists as Integer
ContactBC = GetSaveBusComp ContactExists = ContactBC.FirstRecord()
if ContactExists then
Answer = "Y"
else
Answer = "N"
end if
Question_PreBranch = ContinueOperation
End Sub
Siebel eScript Code
function Question_PreBranch (&Answer)
{
var ContactBC;
var ContactExists;
ContactBC = GetSaveBusComp ();
ContactExists = ContactBC.FirstRecord ();
if (ContactExists) {
Answer = "Y";
}
else
{
Answer = "N";
} return (ContinueOperation);
Siebel VB Code
Function Question_PreLeave() As Integer
Script.Finish
TheApplication.InvokeMethod "RunSmartScript", "Voicemail Script", "", "ENU", "USD" Question_PreLeave = ContinueOperation
End Function
Siebel eScript Code
function Question_PreLeave ()
{
Script().Finish ();
TheApplication().InvokeMethod ("RunSmartScript",
"Voicemail Script", "", "ENU", "USD")
return (ContinueOperation);
}
|