FindAncestor
Returns the closest ancestor of a specified business object instance in a hierarchy of business objects.
For each ancestor business object going upward from a starting business object, this function evaluates the search predicate on the related business object. If a hierarchy business object is not related to one of the related business objects, the application skips it. See Expression Grammar, Defining a CI relationship, and Using Relationships.
Syntax
FindAncestor(hierarchyBoRef, relatedBoRef, recId, searchPredicate)
Enabled For
For a description of the business object categories, see Notes on "Enabled For".
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 |
| |
Parameters
Parameter | Description |
|---|---|
hierarchyObjectRef | The name of the business object (the starting business object) that forms the hierarchy in which to find the ancestor. This is not a business object reference. |
relatedObjectRef | The name of the related business object. |
recId | The RecID of the hierarchy business object instance. |
searchPredicate | (Optional) Boolean filter expression to evaluate on the related business object. |
Return Value
Text value. The RecID of the ancestor instance found.
Example
In the example above, the application goes up the through the ancestors of the business object specified by the hierarchyObjectRef parameter (in this case, Frs_CompositeContract_Entity) and looks for the nearest ancestor that has a related business object or a business object related by the relatedObjectRef parameter (in this case, a published service agreement) for which the searchPredicate parameter evaluates to true.
