Updating a Case Object

From within a process, you can use scripting to update a local BOM object of the appropriate case class, then use a global data service task to update the case object from the local data.

Note:

You do not need to follow this procedure if you use a case object as an IN/OUT parameter on a form in a business process. In that case, changes made by the user are automatically written back to the case data store when the user closes or submits the form. See Displaying a Case Object in a User Task - Using a Form.

However, you do need to follow this procedure if you display a case object as part of a pageflow process. See Displaying a Case Object in a User Task - Using a Pageflow.

Prerequisites

The process must already contain:

  • A data field containing a case reference to the case object that you want to update.
  • A local business object created from the appropriate case class, containing the data that you want to write to the case object.

Procedure

  1. Add a service task at an appropriate point in the process.
  2. On the General tab of the Properties view, set Service Type to Global Data Operations.
  3. Select Change or Delete Case Object(s) Using Case Reference Field.
  4. In the Case Reference field, select the data field that contains the case reference to the case object that you want to update.
    Content assistance is available on the Case Reference and Local Data Value fields. Click the lightbulb icon or press CTRL+space to display a list of valid field names that are available to the task and that begin with the characters to the left of the cursor.
  5. In the Operation field, select Update Case Object(s) From Local Data.
  6. In the Local Data Value(s) field, enter the name of the data field that holds the local business object.
    If the selected Case Reference field is an array then the selected Local Data Value field must also be an array, with an element corresponding to each case reference array element.

What to do next

  1. (Optional) Add appropriate error handling to the service task boundary to deal with the following specific errors that may be returned by the Update Case Object(s) From Local Data operation.
    Error (Error Code) Description Possible solutions
    CaseOutOfSyncError (CaseOutOfSyncError) The case object referenced from the Case Reference field has been modified in some way since the field was last populated. That is, the case reference is stale.

    This could be either a change to the data held in the case object, and/or a change in the object's internal version number.

    1. Re-read the case object.
    2. If necessary, examine the case data to check that no significant changes have occurred.
    3. Retry the Update Case Object(s) From Local Data operation.
    UserApplicationError (CaseNotFoundError) The case object referenced from the Case Reference field does not exist.
    UserApplicationError (UpdateToNullError) The case object referenced from the Case Reference field has not been initialized (has a null value).
  2. (Optional) Modify any process that may need to do something if this case object is updated:
    1. Add a case data signal event to the process, so that the process will be notified when the case object is updated.
    2. Add suitable business logic to perform any actions that the process needs to take as a result of the update to the case object.