Siebel SmartScript Administration Guide > Extending Scripts with Siebel VB and Siebel eScript > Sample Siebel VB and Siebel eScript Methods >

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. The code relies on the preceding sample for data acquisition and database querying.

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"


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";




Answer = "N";

} return (ContinueOperation);

Siebel VB Code

Function Question_PreLeave() As Integer


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);


Siebel SmartScript Administration Guide