Skip to content

ODataService CallFunction

CallFunction action is used to execute OData FunctionImport or ActionImport.

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

ODataService CallFunction Properties

Property Type Required
Headers object Optional
RequestOptions RequestOptions Optional
Target CallFunctionTarget 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

RequestOptions

Options for processing of data requests


Target


_Type

  • type: const

The value of this property must be equal to:

"Action.Type.ODataService.CallFunction"

Note

  1. CallFunction action returns an empty string in the offline mode. The App user needs to upload the pending changes to the backend to complete the transaction. Currently offline mode only supports OData Version 2 and HTTP POST method.
  2. CallFunction will store the results in the ActionBinding automatically. The App can bind it to Control directly like the example below. The parameter Target is the CallFunction name and case senstive.
{
  "ObjectCell": {
    "Footnote": "{CategoryName}",
    "Title": "{CategoryID}"
  },
  "Target": "{GetOneCategory}",
  "_Name": "SectionObjectCollection0",
  "_Type": "Section.Type.ObjectCollection"
}

Action Result

The ActionResult of this action is a JS primitive type, object or a JS array.


Examples

{
  "_Type": "Action.Type.ODataService.CallFunction",
  "Target": {
    "Function": {
      "Name": "UpdateCustomerDetail",
      "Parameters": {
        "FirstName": "Lewis",
        "LastName": "Black",
        "Emails": [
          "lewisblack@example.com",
          "lewisblack@google.com"
        ],
        "Address": {
          "Street": "187 Suffolk Ln.",
          "City": "Boise"
        }
      }
    },
    "Service": "/MyMDKApp/Services/MyOData.service"
  }
}