---
title: FindAncestor
slug: neurons-for-itsm/admin-user-help/enu/latest/findancestor
createdAt: 2026-07-14T19:16:34.538Z
---

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     |
| 1. 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

:::Paragraph{indent="1"}
Text value. The RecID of the ancestor instance found.
:::

## Example

:::BlockQuote
$(FindAncestor("Frs\_CompositeContract\_Entity", "ServiceAgreement", EntityLink\_RecID,
"$((ServiceLink == \[OtherObject]Service\_Valid) && (Status == \\"Published\\"))"
))
:::

:::Paragraph{indent="1"}
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.
:::
