18.4.8.7 Working with Parent and Child Data in Regions
Learn about working with parent and child data in regions.
A BOSS business object can be related to one or more collections of composed child
objects. For example, an Order
object can compose a related
collection of OrderLine
child business objects. A parent object,
like Order
, can have multiple composed child collections, and each
collection can comprise business objects that, in turn, contain composed
collections. For example, each OrderLine
business object that is
part of an Order
can have a composed collection of
OrderLineFulfillment
child business objects.
When working with a root business object like Order
that has a composed child collection, clients like APEX can read and write child objects using a nested resource name that includes the
resource key of a specific parent object. For example, to list the
OrderLine
child objects for order 12345, the REST endpoint
would end with the path:
/orders/12345/orderLines
In the previous example, 12345
is the resource key of a specific
order, and orderLines
is the name of the Order object’s accessor
attribute of type object-collection
.
To work with the child objects of a specific OrderLine
with resource
key 67890, on a specific Order
with resource key 12345, the REST
endpoint URL would end with:
/orders/12345/orderLines/67890/orderLineFulfillments
The orderLineFulfillments
is the name of the
OrderLine
object’s accessor attribute of type
object-collection
.
You can define REST Data Sources for the nested resources, using a named parameter in the URL path like this for the order lines:
/orders/:orderId/orderLines
To access a second-level child, the REST Data Source’s endpoint URL can contain multiple URL path parameters, for example:
/orders/:orderId/orderLines/:orderLineId/orderLineFulfillments
When using these parameterized REST Data Sources in a region on a page, you can then bind the value of the REST Data Source’s URL path parameters under the Parameters node in the Rendering tab for the region to use an appropriate page item.