---
url: /process-functions/hierarchy-exists.md
description: Checks whether a hierarchy exists.
---

# hierarchy.exists

Checks whether a hierarchy exists.

```js
hierarchy.exists(dimension, hierarchy)
```

## Parameters

| Parameter | Type | Description |
|---|---|---|
| `dimension` | `string` | The dimension's name or id. |
| `hierarchy` | `string` | The hierarchy's name. |

## Returns

`true` when the hierarchy exists, otherwise `false`, including when the dimension can't be found.

## Examples

```js
if (hierarchy.exists("Account", "Profit and Loss")) {
    // do something
}
```
