The method that Process Director uses to detect and respond to events is called "Event Mapping", and, indeed, Event Mapping is a tab in the Properties section of the eForm definition. In the Event Mapping tab, events are mapped to Custom Tasks that are executed when triggered by those events. A Custom Task is a reusable, packaged script containing business logic or other programming functionality. Custom Tasks can be created by software developers to perform a couple of important things. First, Custom Tasks can be used to implement business functions that are unique to your environment. Custom Tasks can also implement common functions that can be used across multiple eForms and processes. Process Director includes several standard Custom Tasks performing common operations such as exporting form data to Word documents or PDF file, setting values in a form, extracting data from SharePoint, and much more.
Event mapping enables you to select a Custom Task to run when a form event occurs, then map that Custom task to a specific form event. Every eForm has a set of default form events that are displayed in the Event Name dropdown set off by square brackets (). On the Custom Task Event Mapping tab of the eForm definition, you will see the dropdown control named Event Name once you add a Custom task to the eform.
The View State Init event is triggered when an eForm is opened (or refreshed). This event is useful for pre- populating some of the form fields with values that you do not need the form's user to edit. For instance, you may have a Date control that you want to populate with the current date when the form is opened, or a User Picker control that you want to populate with the identity of the current user.
The eForm Completed event is useful to run a Custom task after the user has clicked the submit button on a form. This event runs after the form is no longer visible to the user, so it's a good event to use for form or data housekeeping just before the form is submitted to the system.
When you set the Event Field property of a field to "True", the field's name appears in the list of events you can map. Selecting the field name from the events dropdown enables you to map a Custom task to that event. An example of the Event Name dropdown, showing both the default and custom events for the Travel Expenses Request eForm, is shown in Figure 49: Events Dropdown, below.
Conditions are true or false statements that are evaluated in order to determine an appropriate response. In the Travel Expenses Request eForm in the sample project, for example, there is a condition that determines whether the user must enter a justification for the expense, based on whether the total expense amount exceeds $1,000. The condition that must be evaluated for this is:
ExpensesTotal > 1000
If this condition evaluates to "true" then the Justification Section is made visible on the eForm.