Skip to content

ODataService CreateRelatedEntity

CreateRelatedEntity action is used to create an entity in the target system, related to a parent entity via a parent navigation property.

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

ODataService CreateRelatedEntity Properties

Property Type Required
Headers object Optional
ParentLink LinkItem Required
Properties object Optional
RequestOptions RequestOptions Optional
Target Target Required
_Type const Required

Headers

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

  • type: object

Parent navigation property to be linked.


Properties

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

  • type: object

RequestOptions

Options for processing of data requests


Target


_Type

  • type: const

The value of this property must be equal to:

"Action.Type.ODataService.CreateRelatedEntity"

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


Examples

CreateRelatedEntity

{
  "_Type": "Action.Type.ODataService.CreateRelatedEntity",
  "Target": {
    "Service": "/MyMDKApp/Services/MyOData.service",
    "EntitySet": "Orders"
  },
  "Properties": {
    "OrderID": "#Control:OrderID/#Value"
  },
  "ParentLink": {
    "Property": "Orders",
    "Target": {
      "EntitySet": "Customers",
      "ReadLink": "{@odata.readLink}"
    }
  }
}

CreateRelatedEntity without Properties

{
  "_Type": "Action.Type.ODataService.CreateRelatedEntity",
  "Target": {
    "Service": "/MyMDKApp/Services/MyOData.service",
    "EntitySet": "Orders"
  },
  "ParentLink": {
    "Property": "Orders",
    "Target": {
      "EntitySet": "Customers",
      "ReadLink": "{@odata.readLink}"
    }
  }
}