OData - Provide data - Function properties

Integration module Provide data OData / New service / Continue to Functions Functions / Add function

The properties of a function are defined here.


The unique name of the function. It cannot contain special characters or spaces.

HTTP method

Defines the HTTP method that will be used to request the function.

Entity set name (optional)

Defines the entity set on which the function operates.

Return type

Defines the return value type of the function. This can be either an OData data type (such as "Edm.String", "Edm.Int32", "Edm.Double", etc.) or an Entity Type.

Is collection

Defines whether the return value contains one or multiple data records/values.


List of input parameters of a function.

A parameter can be added to the parameters list by clicking on "Add parameter", or an existing parameter can be changed by clicking on "Edit parameter".

Groovy Script

The actual function logic is implemented with a Groovy script. To do this, click on "Edit Groovy script" to open the Groovy Editor. All standard Intrexx context objects and classes are available in Groovy. In addition to this, a number of OData-specific context objects are provided:

Access to function parameters in Groovy

Input parameters in a function can be accessed in Groovy as follows:

def l_param = g_oFunctionParameters['BusinessPartnerName']

Definition of the return values of a function

The Groovy return value of a function must correspond to the data type defined in the function properties.

Example 1: Simple return value of type Edm.String

The following Groovy script returns the input value of type Edm.String as result:
def l_param = g_oFunctionParameters['BusinessPartnerName']
def l_ret = "Parameter value: " + l_param
return l_ret

Example 2: Return value of type Entity

To define a single data record as the return value of the function, the fields of the Entity Type are added to a map, which are then returned.
def l_param = g_oFunctionParameters['ID']
				// load record from database
				// return record value as entity type

				def l_entity = [:]
				l_entity['ID'] = 1;
				l_entity['DeliveryStatus'] = 'OPEN';
				l_entity['OrderStatus'] = 1;
				l_entity['BillingStatus'] = 'OPEN';

				return l_entity

Example 3: Return value of type Entity Collection

In this example, data records are loaded based on an input parameter, then the result returned as an Entity Collection (to clarify the example, the instructions to load the data records are not included):
def l_param = g_oFunctionParameters['BusinessPartnerName']
				// load records from database
				// return record values as entities

				def l_entity1 = [:]

				l_entity1['ID'] = 1;
				l_entity1['DeliveryStatus'] = 'OPEN';
				l_entity1['OrderStatus'] = 1;
				l_entity1['BillingStatus'] = 'OPEN';
				l_entity1['TotalSum'] = 1200.00d;

				def l_entity2 = [:]

				l_entity2['ID'] = 2;
				l_entity2['DeliveryStatus'] = 'OPEN';
				l_entity2['OrderStatus'] = 1;
				l_entity2['BillingStatus'] = 'OPEN';
				l_entity2['TotalSum'] = 2300.00d;

				return [l_entity1, l_entity2]
A map is initialized for each data record here. Here, the field names are stored as a key and the values as values. Last, the map objects are stored in a Groovy list object and returned as the result. The OData Provider then converts the data structure corresponding to the data types automatically into the required OData format (JSON/XML).