Business objects
Business objects are representations of business objects such as a Customer, Product or Order. The primary purpose of a business object is to hold the data that is evaluated by event rules at run time. The data that populates a business object does exist in the enterprise applications, but it typically does not exist in a single record or structure.
The fields in a business object can be populated from various sources. For example, a business object that describes a customer might contain the following fields: customer ID, name, home address, phone, email, lifetime value, and last order date. Often these fields come from different sources as shown in the following diagram:
The business object as defined to Decision Server Events is the ideal representation of the business object. It serves as a template for sharing data, containing a number of fields that can be populated from many different business applications across the enterprise. Each field includes the name and type of the information, as well as an optional definition for how to get a value, if none is supplied with the event.
Fields in business objects are referenced when building rules, filters, and action objects.
Business objects are used during the evaluation of event rules in the event runtime. The values of fields in the business objects are populated at run time in one of two ways:
- The value of business object fields can be constructed from event objects by using event object fields. Field constructors are used to indicate how a particular business object field is constructed.
- The value of business objects fields can have a definition of one of several different types:
The definition type for a business object field in Event Designer indicates how the field is to be populated, if it is not constructed from an event object:
- Undefined. The field has no definition type. The field is null, if no value is constructed from an event object.
- Constant value. A simple default value is used if the field is not constructed.
- Filter. A Boolean value derived from evaluating a filter.
- JavaScript. The value returned from a JavaScript expression.
- Named constant. A named default value that can easily be changed throughout an application.
- Enriched by mapped key. The field is mapped to values retrieved from a data connection. The database query is automatically generated by using key values specified in the business object fields.
- Enriched by mapped condition. The field is mapped to values retrieved from a data connection. The database query is generated by using a SQL WHERE clause that you define.
- Enriched by mapped query. The field is mapped to values retrieved from a data connection. The database query is an SQL SELECT expression or stored procedure call that you define.
- Enriched by expression. The value of the field is retrieved from a data connection by using an SQL SELECT expression or stored procedure call that you define.
- Enriched by business rules. The field is mapped to a ruleset parameter from a business rules data connection and the value is computed by invoking the ruleset.
- As a new business object: You start with an empty business object and add new fields that match your business definition of the object.
- From an Event object. The business object is created with the same fields as the event object.
- Directly from an existing data connection. Define the data connection to the business object and then identify the key fields.
- As a generated business object from a new business rules data connection. Use the New Data Connection function to create a new business rule data connection and generate business objects from ruleset parameters.
Typically, business object instances are transient. (For information about keeping business objects across events within a context, see Sharing data across events in a context.) Business objects exist for as long as they are required for event evaluation and action construction. At run time, when an event is retrieved by the event runtime, corresponding business object instances are created. Which business objects are created and the number of instances of each business object depends on how the event is structured.
When the event is processed, the event runtime evaluates all the rules for that event. When the event runtime encounters a field, whose value was not supplied from an event object, the data resolver attempts to retrieve the missing data based on the definition of the field. Then, event rule evaluation continues. For those event rules that evaluate to true, the event runtime builds an associated action instance. When the event rule evaluation for the event is complete, the corresponding business object instances are removed from memory.