ChildFold
Iterates through the given child business objects, evaluating the given expression in the context of each of the child business objects. The results of the expression evaluations are aggregated using the aggregatorFunc parameter.
Evaluates an expression for each selected object instance related to (a child of) a parent object and applies an aggregator function to the results. The childPredicateExpression parameter, if specified, selects which related objects to include. If not specified, they are all included.
In this release, HEAT only supports the plus (+) aggregator operator. In the future, we may support additional aggregator operators such as multiplication (*), minimum (min), maximum (max), etc. |
Syntax
ChildFold(parentObjectRef, parentRecId, childRelationshipRef, childExpression, aggregatorFunc, childPredicateExpression)
Enabled for
Search/Dashboard | No |
Business Rules | Yes |
Quick Actions | Yes |
Workflow Objects | Yes |
Reports | No |
Parameters
parentObjectRef | The name of the parent business object. |
parentRecId | The RecID of the instance of the parent business object. |
childRelationshipRef |
A relationship specifier for the relationship relating the parent to its related object (child object). |
childExpression | The expression to evaluate for each child business object. |
aggregatorFunc |
An aggregation function specified as a string. In this release, HEAT 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
To determine the number of instances of the child business objects associated with a parent incident business object, enter the following:
$(ChildFold("Change#", "213KJASD92132SD", "Task#Assignment.", "Cost + 100", "+"))
This looks up the change business object where the RecId is "213KJASD92132SD" and finds all of the task objects related to this change object through the relation "Task#Assignment". In the context of each of these child business objects, the function evaluates the expression Cost + 100 and combines all of these computed values using addition.
Another example counts all the "Task#Assignment" children that are not canceled.
$(ChildFold("Incident#", RecId, "Task#Assignment.Rev4", "$(iif(Status == 'Canceled',0,1))", "+"))
In another example, you can update a field in the change business object to get a count of the incidents:
$(ChildFold("Change#", RecId, "Incident#.IncidentAssociatesChange", "$(iif(Status == 'Active',1,0))", "+"))
Incident#. is the relationship reference to the child incident business object, where the internal reference name for the IncidentAssociatesChange relationship is empty. If the internal reference name of the relationship is populated, use instead: Incident#.<Internal Reference Name>, where the internal reference name is after the period.
If the relationship is to a group member object such as FRS_Knowledge.IssueResolution, you would use: FRS_Knowledge#IssueResolution.<Internal Reference Name>. Notice the member object is between the "# and the . in all examples.