Open topic with navigation

TIBCO Business Studio™ - BPM Edition 5.4.0

# Creating a New Case Object

Within a process, you can create a case object by first creating a process data field of the case class type, using a script and other tasks to create the object and set values in it. Then use a Case Data Operations service task to create the case object from the local data (by adding the case object to the case data store).

Before you begin

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:

   `data.cust = factory.com_example_scriptingguide.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 automatic case identifier you cannot (and do not need to) assign a value for it. You must assign values for manual case identifiers.
4. Add a service task to the process.
5. On the General tab of the Properties view, set Service Type to Case Data Operations.
6. Select Create Case Object(s).
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 is returned to this field.

Result BPM now has two copies available of the same data - the local BOM object and the case object. These objects are separate entities and are not 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 might be returned by the Create Case operation.

Error (Error Code) | Description | Possible solutions
--- | --- | ---
NonUniqueCaseIdentifierError (NonUniqueCIDError) | The manual 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.

Did you find this helpful?

Yes No
Great!
Thanks for taking the time to give us some feedback.
Sorry about that

Why wasn't this helpful? (check all that apply)

Could not find what I was looking for
Instructions confusing or unclear
Instructions did not work

Want to tell us more?

Please select at least one option or provide details about the issue!!

Error occurred while submitting feedback.

Error2 occurred while submitting feedback.

TIBCO Business Studio™ - BPM Edition

Copyright © 2015-2023. Cloud Software Group, Inc. All Rights Reserved.