Multi-level definition
It is also possible to link BOs. For example, linking a Person to the Department where this person works, so that this data can later be retrieved in one call.
In order to make this work, create two single-level definitions as explained in the previous section (create a definition for Person and one for Department). Add all field definitions.
These two definitions should be connected: a Person works for a Department.
To create this connection:
1. On Definitions level: click the Person definition
2. On Field definitions level: click the DepartmentRef field
This field will become the connection to the Department definition
3. On the General tab, this field initially is referenced as a PRIMARYKEY. Change that setting to RESTAPIDEFINITION.
4. An additional setting becomes available for the DepartmentRef field. Click the selection icon. Notice that the Reference to REST API definition pop-up does not show any available definitions:
That is, because only definitions that have status Published or Unpublished are listed here.
5. So, the Department definition needs to be published or unpublished to appear in this list. Please do so.
6. Now, the REST API definition DepartmentRef refers to, can be selected. In our case, this is Department:
7. Click Save
8. Publish both definitions
Remarks:
You can create as many connections as are necessary.
Reference fields can be recognized by their name: they usually end with Ref.
You can also create a chain of connections. For example:
an OrderLine is linked to an Order
an Order is linked to a Customer
a Customer is linked to an AccountManager (which is a Person)
Note that, for performance reasons, the response of a REST API call only contains the data of one additional level. Deeper levels are ignored.