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.

Sample 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

Sample eScript Code

function Question_PreBranch (&Answer)
{
  var ContactBC;
  var ContactExists;
  ContactBC = GetSaveBusComp ();
  ContactExists = ContactBC.FirstRecord ();
  if (ContactExists) 
  {
    Answer = "Y";
  }
  else 
  {
  Answer = "N";
  } return (ContinueOperation);

Sample VB Code

Function Question_PreLeave() As Integer

	Script.Finish 

	TheApplication.InvokeMethod "RunSmartScript",  “Voicemail Script", "", "ENU", "USD"
	Question_PreLeave = ContinueOperation

End Function

Sample eScript Code

function Question_PreLeave ()

{

	Script().Finish ();

	TheApplication().InvokeMethod ("RunSmartScript", 

		"Voicemail Script", "", "ENU", "USD")

	return (ContinueOperation);
}