Skip to content

ODataService ChangeSet

Change set actions are configured with an array of actions that are executed serially. If any action fails the entire change set fails.

The properties defined in Action are also applicable to this action.

ODataService ChangeSet Properties

Property Type Required
Actions ActionOrRule Required
Target ServiceOnlyTarget Required
_Type const Required

Actions

An array of OData actions that'll be executed serially. If any action fails the entire change set fails

  • type: ActionOrRule[]

All array items must be of the type: ActionOrRule


Target

Only service name is required


_Type

  • type: const

The value of this property must be equal to:

"Action.Type.ODataService.ChangeSet"

Action Result

There is no ActionResult for this action.


Examples

Note: A typical use case is to have the one action start a chain of actions. In this example,navigating to Page One will chain a series of actions that would validate and apply the changes made to an object displayed on that page. Assuming all actions are completed successfully and the user doesn't cancel the next action in the array is executed.

Multi-page

{
  "_Type": "Action.Type.ChangeSet",
  "Target": {
    "Service": "/MyMDKApp/Services/MyOData.service"
  },
  "Actions": [
    "/MyMDKApp/Actions/ChangeSet/NavigateToPageOne.action",
    "/MyMDKApp/Actions/ChangeSet/NavigateToPageTwo.action"
  ]
}

Multi-page with failure / success chaining

{
  "_Type": "Action.Type.ChangeSet",
  "Target": {
    "Service": "/MyMDKApp/Services/MyOData.service"
  },
  "Actions": [
    "/MyMDKApp/Actions/ChangeSet/NavigateToPageOne.action",
    "/MyMDKApp/Actions/ChangeSet/NavigateToPageTwo.action"
  ],
  "OnSuccess": "/MyMDKApp/Actions/ChangeSet/ChangeSetSuccessMessage.action",
  "OnFailure": "/MyMDKApp/Actions/ChangeSet/ChangeSetFailureMessage.action"
}

When entities are created as part of a ChangeSet, they do not get actually created in the store until the ChangeSet is processed (i.e. until the last action of the ChangeSet has been completed). As a result, they would not appear in a list which queries the EntitySet they belong to, if the query is executed as part of the same ChangeSet in which they have been created.

In other words, this would not work:

  1. Begin ChangeSet
  2. Create an entity of type MyWorkOrderHeader
  3. Create an entity of type MyWorkOrderOperation
  4. Display a list of all WorkOrders, in order to select the newly created WorkOrder from it, and then link it to the Operation

The newly created WorkOrder would not show up in the list, as it does not exist yet.

To go around this limitation, when entities get created in a ChangeSet, they get assigned a temporary, ordinal ReadLink until the ChangeSet completes. If those entities need to be referred to in subsequent actions which are part of the same ChangeSet, this temporary ReadLink is used.

The prefix of the ReadLink is "pending_", followed by an ordinal, i.e. "pending_1", "pending_2", etc.

In the below code, which refers to the example described above, this is how the new Operation would refer to the new WorkOrder, in the CreateLinks section:

"CreateLinks": [
    {
      "Property": "WOHeader",
      "Target": {
        "EntitySet": "MyWorkOrderHeaders",
        "ReadLink": "pending_1"
      }
    }
  ]