HierarchicalChildFold
7 min
for a parent business object (e g “organizationalunit”) which has a hierarchical self relationship selfrelationshipref to itself, this system function will recursively traverse through the hierarchy from the current node to its leaf nodes, via the self relationship at a leaf node, it will iterate through the specified child business objects via the child relationship childrelationshipref, evaluating the childexpression in the context of each of the child business objects the results of the expression evaluations are aggregated using the aggregatorfunc parameter the results from the child node is then passed up to the parent node and aggregated using the aggregatorfunc parameter this process continues up the hierarchy, until the aggregation completes at the original node in essence, the hierarchicalchildfold function supports a rollup aggregation for the child business objects which appear within a specific hierarchy in this release, only supports the plus (+) aggregator operator syntax hierarchicalchildfold (parentobjectref, parentrecid, selfrelationshipref, displayfieldname, childrelationshipref, childexpression, aggregatorfunc, childpredicateexpression) enabled for for a description of the business object categories, see notes on "enabled for" docid\ u26v9fecfs6ilwa0 pvjd business object category yes/no business rules before save rules yes business rules calculation rules (after save, with or without also recalculate on load) yes business rules calculation rules (before save or always, without also recalculate on load) yes business rules calculation rules (before save or always, with recalculate on load) yes business rules editing rules yes1 business rules initialization rules yes business rules read only rules no business rules required rules yes1 business rules validation rules yes client expressions no object permissions no services yes ldap yes mobile yes quick actions (except ui quick actions) yes ui quick actions no reports yes search/dashboard without field references yes search/dashboard with field references no 1 except when this field appears on a form or is triggered by such a field parameters parameter description parentobjectref the name of the parent business object this business object needs to have a self relationship to itself (e g “organizationalunit”) parentrecid the recid of the instance of the parent business object this is the source of the traversal through the hierarchy, before reaching the child business object selfrelationshipref the name for the relationship relating the parent to itself the expression editor will check at design time to ensure that the specified relationship is indeed a self relationship, and will show an error and prevent saving of the expression if an invalid relationship is specified displayfieldname a field in the parent business object which provides the display name for the given record the primary intent of this property is to display an error message while evaluating the expression, with the names of the nodes in which a cyclic dependency has been detected, while traversing the hierarchy childrelationshipref a name for the relationship relating the parent (e g “organizationalunit”) to its related object (child business object; e g “ci”) childexpression the expression to evaluate for each child business object this is typically a field reference or it can be a sub expression aggregatorfunc an aggregation function specified as a string in this release, only supports the plus (+) aggregator childpredicateexpression (optional) a boolean expression that is evaluated for each child the child is only included if the result of this evaluation is true return value unicode text value example the hierarchicalchildfold system function is currently used in the out of the box implementation of ivanti asset manager, specifically the “calculate aggregate values” quickaction that is defined in the organizationalunit business object in the asset manager object model, there is a relationship defined between organizationalunit and itself called “organizationalunit# parent ou rel” – this corresponds to the selfrelationshipref parameter there is also a relationship defined between organizationalunit and the child ci called “ci# ciassociatedembeddedorganizationalunit” – this corresponds to the childrelationshipref parameter in the ci business object, there is a field called ivnt purchaseprice, which defines the purchase price for the given ci (i e asset) to calculate the total purchase price across all of the cis for a specific organizationalunit, the existing childfold expression can be used $(childfold("organizationalunit#", recid, "ci# ciassociatedembeddedorganizationalunit", "ivnt purchaseprice", "+")) to calculate the total purchase price across all of the cis for a specific organizational unit, as well as all child organizational units in the hierarchy, the new hierarchicalchildfold expression can be used $(hierarchicalchildfold("organizationalunit#", recid, "organizationalunit# parent ou rel", "name", "ci# ciassociatedembeddedorganizationalunit", "ivnt purchaseprice", "+")) compared to the earlier childfold expression, the hierarchicalchildfold expression has the addition of the selfrelationshipref and displayfieldname properties, otherwise the body of the expression is identical for both expressions advanced example the above example makes use of the “ivnt purchaseprice” field in ci as the child expression the ci business object has a relationship to frs itfm transaction, which represents the financial transactions for a given ci for calculating the total cost, the following childfold expression can be used $(childfold("ci#", recid, "frs itfm transaction# costitem", $(cost), "+")) for calculating the total cost across all cis, the following childfold expression can be used – notice how it embeds the above childfold expression in the main childfold expression $(childfold("organizationalunit#", recid, "ci# ciassociatedembeddedorganizationalunit", $(childfold("ci#", recid, "frs itfm transaction# costitem", $(cost), "+")), "+")) the above expression represents the total cost of ownership for the given organizational unit to calculate the total cost of ownership across all of the cis for a specific organizational unit, as well as all child organizational units in the hierarchy, the new hierarchicalchildfold expression can be used $(hierarchicalchildfold("organizationalunit#", recid, "organizationalunit# parent ou rel", "name", "ci# ciassociatedembeddedorganizationalunit", $(childfold("ci#", recid, "frs itfm transaction# costitem", $(cost), "+")), "+")) as in the earlier example, compared to the earlier childfold expression, the hierarchicalchildfold expression has the addition of the selfrelationshipref and displayfieldname properties, otherwise the body of the expression is identical for both expressions
