Creating a New Case Object

Within a process, you can create a case object by first creating a local BOM object from the case class, then using a global data service task to create the case object from the local data (by adding the case object to the case data store).

Prerequisites

The Business Data project that contains the case class that you want to use must exist in the same workspace as the process from which you want to create the case object.

Procedure

  1. Create a new data field, of type BOM Type, which references the appropriate case class.
  2. In a script, use the appropriate factory method to create an instance of the case class as a local business object and assign it to the data field. (See Creating a Case Data Model.) For example:

    cust = com_example_scriptingguide_Factory.createCustomer();

  3. Populate the local business object with the appropriate data. You must assign a value for each mandatory attribute in the case class.
    Note: If the case class uses an an automatic case identifier you cannot (and do not need to) assign a value for it. You must assign values for custom or composite case identifiers.
  4. Add a service task to the process.
  5. On the General tab of the Properties view, set Service Type to Global Data Operations.
  6. Select Create Case Object(s) or Delete Case Object(s) by Case Identifier.
  7. In the Case Class field, select the same case class that you used to create the local business object.
  8. In the Local Data Value(s) field, enter the name of the data field that holds the local business object.
  9. Create a new data field, of type Case Class Reference, which references the same case class.
  10. In the Return Case Reference(s) field, enter the name of this field.
    When the service task is executed, the case reference for the newly created case object will be returned to this field.

Result

ActiveMatrix BPM now has two copies available of the same data - the local BOM object and the case object. These objects are separate entities and and will not be maintained in step:
  • The local BOM object is only visible to the process and can only be manipulated in and by that process.
  • The case object is visible to and can be manipulated by any process that has access to its case data model.

Any updates to the case object are not automatically reflected in the local BOM object, and vice versa.

What to do next

(Optional) Add appropriate error handling to the service task boundary to deal with the following specific error that may be returned by the Create Case operation.

Error (Error Code) Description Possible solutions
NonUniqueCaseIdentifierError (NonUniqueCIDError) The (custom or composite) case identifier specified in the Local Data Value(s) field cannot be used because it is not unique. An existing case object already uses this case identifier. Amend the case identifier value(s) in the local data object and retry the Create Case operation.