Wait For Event Action

The first action of the top element must be a wait action. Create an Activity element as the child of the Root Element and create a wait action.

With the creation of this element, the workflow process waits for an event (Web Contact)

The wait action is specific to workflow design. There are three types of wait actions:

  • Wait for timer
  • Wait for event
  • Wait for message
A timer wait action is an action that waits until the timer runs out. After the timer runs out, it starts executing the next action or goes to the next element. An example of this element can be seen in the Wait 15 Element of this workflow example.

An event wait action is triggered when an event occurs. These events may be someone submitting a web form, a new customer record being added to the CRM, a phone call being made or received, etc. An example of this is the element that we just created. Here, we're waiting for the event "Web Contact". This event can be triggered by an action parameter sent to vxwf.jsp of our gateway. Check out the signuphandler.php below for the specifics.

A message wait action is triggered when the workflow instance receives a message. This message may be sent via web form, etc. The message can be any message. An example of this is in the Notify Presenter Element.

Webinar Sign-up Page

We create a simple sign-up page for a customer to contact us. Our example sign-up page is below:

This is basically a simple HTML form, containing the following parameters: first_name, last_name, email, other_phone, info, form_id, and user. Please note that since we need to add these info to Voicent CRM, it is easier to choose the same name required by the CRM web interface.

The target to the sign-up form is a php file that creates a CRM record using the given information and contacts our workflow to end the "Web Contact" wait action. The following is our example:

Create a new CRM record

Voicent CRM has a web interface for adding new contact info. The URL is the gateway url followed by /vxcrm.jsp. This interface is not limited to workflow. More info is at: http://voicent.com/predictive-dialer/blog/index.php/predictive-dialer/803/call-center-crm-dynamic-campaigns

In our example, this is the code that we use to append to vxcrm.jsp to create a new CRM record using the information the customer submitted:
$formParams = http_build_query($_POST);
$params = "action=add&passwd=crmweb&customer_catname=Lead&" . $formParams;
The CRM web access password is defined in Voicent gateway. The default is crmweb.
Also note that the customer category is set to Lead.

Signal a Workflow Event

Once the CRM record is added, we grab the CRM customer ID, which will be used in the workflow. The URL to submit data to workflow is /vxwf.jsp. The following php code signals the web event:

$params = "action=webevent&crmcusid=" . $crmCusId . "&". $formParams;
$ch = curl_init("" . $params);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$rcstr = curl_exec($ch);

The action must set to webevent. In this example, the web event is signaled along with customer's CRM record ID, and the rest of the original form's name value pairs (captured in $formParams).

When the workflow engine receives the web event, it checks all the defined workflow processes, looking for processes that are waiting for a web event. Once it finds one, it sets the __VG__WEBFORM__ variables with all the name value pairs in the signaling web form. In this example, it is all the values in $formParams. The engine then creates an workflow instance based on the workflow process. You can find more information about workflow instances here.

In this example, the workflow instance checks whether the __VG__WEBFORM__.form_id is 100, and starts executing the rest of the process. We create this form_id check in the element below.