FindAncestor
5 min
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 docid\ pf6ggqn8 79wx1mpbid , defining a ci relationship docid\ ahauampatmiw4efhud6ws , and using relationships docid\ szcp qyw98hbg7iwleeu2 syntax findancestor(hierarchyboref, relatedboref, recid, searchpredicate) 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 except when this field appears on a form or is triggered by such a field 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 $(findancestor("frs compositecontract entity", "serviceagreement", entitylink recid, "$((servicelink == \[otherobject]service valid) && (status == \\"published\\"))" )) 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
