Skip to content

OfflineOData UndoPendingChanges

While you can make changes to existing entities and new entities locally, you can also undo the pending changes without uploading them by calling the UndoPendingChanges Action for an entity object . An existing entity will be restored to the original status as if no any changes had been made. A new entity will be removed as if the entity had never been created, and a deleted entity will be restored to the offline store.

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

OfflineOData UndoPendingChanges Properties

Property Type Required
Target LinkQueryTarget Required
_Type const Required

Target

This action can only be executed on a single entity. therefore the Target specifier must be configured to return only 1 entity, otherwise this action will fail


_Type

  • type: const

The value of this property must be equal to:

"Action.Type.OfflineOData.UndoPendingChanges"

Action Result

Refer to the MDK Guide to understand what an action result is.

The success ActionResult of this action is a JS object containing the undone entity or null. The failure ActionResult is an error message.


Examples

{ 
  "_Type": "Action.Type.OfflineOData.UndoPendingChanges",
  "Target": {
    "Service": "/MyMDKApp/Services/MyOData.service",
    "EntitySet": "MyWorkOrderOperations",
    "EditLink": "{@odata.editLink}"
  }
}

Query Options

{
  "_Type": "Action.Type.OfflineOData.UndoPendingChanges",
  "Target": {
    "Service": "/MyMDKApp/Services/MyOData.service",
    "EntitySet": "MyWorkOrderOperations",
    "QueryOptions": "$filter=WorkOrderID eq {WorkOrderID}"
  }
}

Note: For undoing a deleted entity, "EditLink" must be set.