Skip to content

ODataService UpdateEntity

UpdateEntity action is used to update an existing entity in the specified OData service. You can also delete or update links to its navigation properties.

All the properties defined under Action are applicable to this action.

ODataService UpdateEntity Properties

Property Type Required
DeleteLinks LinkItem No
Headers object No
Properties object No
RequestOptions RequestOptions No
Target LinkQueryTarget No
UpdateLinks LinkItem No
_Type const No

List of navigation properties link to be deleted.

  • type: LinkItem[]

All array items must be of the type: LinkItem


Headers

Custom headers to be included as part of the request to the OData Service in key/value pair format

  • type: object

Properties

A list of the target entity's property names and values in key/value pairs format. Complex and Binary property types are supported.

  • type: object

RequestOptions

Options for processing of data requests


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


List of navigation properties link to be updated.

  • type: LinkItem[]

All array items must be of the type: LinkItem


_Type

  • type: const

The value of this property must be:

"Action.Type.ODataService.UpdateEntity"

Any following options needs to be fulfilled.

Option 1

Option 2

Option 3


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 updated entity. The failure ActionResult is an error message.


Examples

Update with Headers & RequestOptions

{
  "_Type": "Action.Type.ODataService.UpdateEntity",
  "Target": {
    "Service": "/MyMDKApp/Services/MyOData.service",
    "EntitySet": "Customers",
    "ReadLink": "{@odata.readLink}"
  },
  "Properties": {
    "CompanyName": "#Control:CompanyName/#Value",
    "ContactName": "#Control:ContactName/#Value"
  },
  "Headers": {
    "Transaction.Ignore": "true"
  },
  "RequestOptions": {
    "UpdateMode": "Replace"
  }
}
{ 
  "_Type": "Action.Type.ODataService.UpdateEntity",
  "Target": {
    "Service": "/MyMDKApp/Services/MyOData.service",
    "EntitySet": "Customers",
    "ReadLink": "{@odata.readLink}"
  },
  "UpdateLinks": [{
    "Property": "Orders",
    "Target": {
      "EntitySet": "Orders",
      "QueryOptions": "$filter=OrderID eq '{#Page:-Previous/OrderID}'"
    }
  }]
}
{ 
  "_Type": "Action.Type.ODataService.UpdateEntity",
  "Target": {
    "Service": "/MyMDKApp/Services/MyOData.service",
    "EntitySet": "Customers",
    "ReadLink": "{@odata.readLink}"
  },
  "UpdateLinks": "/MyMDKApp/Rules/LinkRule.js"
}

Update binary type

{ 
  "_Type": "Action.Type.ODataService.UpdateEntity",
  "Target": {
    "Service": "/MyMDKApp/Services/MyOData.service",
    "EntitySet": "Customers",
    "ReadLink": "{@odata.readLink}"
  },
  "Properties": {
    "BinaryData": "#Control:Attachment/#Value/#Index:0"
  }
}