Dynamic attributes
Sometimes the input expected to be passed to an API is not available through an input namespace or entity key. In these cases, using dynamic attributes may be applicable.
All API resources configured in the Resource Hierarchy tree have an input field whose purpose is to provide the ability to specify dynamic attributes. The value for this field should be a valid XML structure using elements and attributes. The XML structure specified here must match the exact input XML structure accepted by the called API.
One of the most common examples of using dynamic attributes is when a specific inner panel that must call multiple APIs to retrieve all the data that it needs to display. For example, an inner panel of a detail view of the order entity might require calling the getOrderDetails() (the standard detail API), and the getCommonCodeList() API to retrieve data for some combo box on the screen. Since common codes are stored at the rule set level, it is mandatory to make sure the correct rule set for that order is passed as input to the getCommonCodeList() API. The getOrderDetails() API, given the correct output template, returns the rule set key for the order. This rule set key can be passed to the getCommonCodeList() API by referring to the output of the getOrderDetails() API as a dynamic attribute in the input XML of the getCommonCodeList() API.
For example, the getOrderDetails() API returns:
<Order OrderHeaderKey="…" OrderNo="…" RulesetKey="…"/>
The Input field of the API resource definition for getCommonCodeList() , should be:
<CommonCode CodeType="ORDER_TYPE" RulesetKey="xml:/Order/@RulesetKey"/>
Notice that the value of the RulesetKey attribute is set to an XML binding that refers to the output of the getOrderDetails() function. The exact same rules of XML binding that apply when binding inputs inside of a JSP also apply when using dynamic attributes. This example also shows another way dynamic attributes can be used. The CodeType attribute is also specified in the input field in the API resource definition. Here, the value of the attribute is simply set to the static value "ORDER_TYPE". This attribute and value are always passed to this API when it is called. Non-changing input values can be specified in this way.
Another possible value that you can use for a dynamic attribute for an API defined under a detail view is any attribute of the current entity key XML. This is useful when the input to pass to an API does not have the same XML structure of the entity key XML that has been formed in the detail screen. The XML for the current entity is available in a special namespace called SelectionKeyName.
The different mechanisms for specifying API input can be combined. For example, it may be necessary to pass the entity key and some dynamic attribute to an API configured under a detail view action. Since passing the entity key happens automatically, you can still specify an Input under that API with the correct XML structure. Note that the XML structure of the key should match the XML structure of the input field. There are other special namespaces available for use in dynamic attributes.