# Function to get the URI of an entity

**URL:** <https://community.fibery.io/t/function-to-get-the-uri-of-an-entity/4824>\
**Category:** Get Help\
**Created:** [July 21, 2023, 6:08am UTC](https://community.fibery.io/t/function-to-get-the-uri-of-an-entity/4824 "2023-07-21T06:08:43Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![njyo](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/njyo/32/923_2.png) [@njyo](https://community.fibery.io/u/njyo)\
**Post date:** [July 21, 2023, 6:08am UTC](https://community.fibery.io/t/function-to-get-the-uri-of-an-entity/4824/1 "2023-07-21T06:08:43Z")

</div>

When triggering Slack notifications that a new entity was created, edited, etc. (e.g. a support email, etc.) I want to add the link to the entity in the end.

I can manually concatenate the link to the entity, but as our workspace is supposed to be malleable and spaces can be renamed, this will break said formulae whenever it happens.

Is there a function or entity property available in formulae to get an URI to the given entity ideally using the UUID?

Thanks!

---

<div class="post-metadata">

**Author:** ![Oleg](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/oleg/32/1887_2.png) [@Oleg](https://community.fibery.io/u/Oleg)\
**Post date:** [July 21, 2023, 7:07am UTC](https://community.fibery.io/t/function-to-get-the-uri-of-an-entity/4824/2 "2023-07-21T07:07:07Z")

</div>

Hello, @njyo

Please find below the example of template with link to entity.

```auto
{!Public-id!}
<% const utils = context.getService(`utils`); %>

Url is <%= utils.getEntityUrl(Entity.Type, Entity["Public-id"]) %>

```

Please note `{!Public-id!}` is used for hidden initialisation of field `Public-id`.

Thanks,  
Oleg

---

<div class="post-metadata">

**Author:** ![njyo](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/njyo/32/923_2.png) [@njyo](https://community.fibery.io/u/njyo)\
**Post date:** [July 21, 2023, 10:14am UTC](https://community.fibery.io/t/function-to-get-the-uri-of-an-entity/4824/3 "2023-07-21T10:14:18Z")

</div>

Thanks a lot, @Oleg!

Here my script for posterity (for whoever may come by this later):

```auto
{!Public-id!}
<% const utils = context.getService(`utils`); %>

📥 Email from {{From}} with subject: {{Name}}
 <%= utils.getEntityUrl(Entity.Type, Entity["Public-id"]) %>

```

---

<div class="post-metadata">

**Author:** ![Matt\_Blais](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/matt_blais/32/1464_2.png) [@Matt\_Blais](https://community.fibery.io/u/Matt_Blais)\
**Post date:** [July 21, 2023, 4:38pm UTC](https://community.fibery.io/t/function-to-get-the-uri-of-an-entity/4824/4 "2023-07-21T16:38:37Z")

</div>

This deserves to be a built-in function, that would not require research plus three lines of code every time it is needed – something like `{{%EntityUrl}}`

---

<div class="post-metadata">

**Author:** ![njyo](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/njyo/32/923_2.png) [@njyo](https://community.fibery.io/u/njyo)\
**Post date:** [July 21, 2023, 5:05pm UTC](https://community.fibery.io/t/function-to-get-the-uri-of-an-entity/4824/5 "2023-07-21T17:05:56Z")

</div>

Absolutely agree @Matt_Blais!

And, ideally, I’d want the format be:  
`<instance>.fibery.io/<uuid>`

So that even if a database gets moved to a different space, it’ll still work.

Thanks!

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [July 21, 2023, 8:11pm UTC](https://community.fibery.io/t/function-to-get-the-uri-of-an-entity/4824/6 "2023-07-21T20:11:16Z")

</div>

> [@njyo](#):
>
> And, ideally, I’d want the format be:  
> `<instance>.fibery.io/<uuid>`

Unfortunately, I believe UUID is actually not guaranteed to be unique within a workspace, only within a given database.

I guess it could be  
`<instance>.fibery.io/<dbid>/<uuid>`

---

<div class="post-metadata">

**Author:** ![njyo](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/njyo/32/923_2.png) [@njyo](https://community.fibery.io/u/njyo)\
**Post date:** [July 22, 2023, 10:58am UTC](https://community.fibery.io/t/function-to-get-the-uri-of-an-entity/4824/7 "2023-07-22T10:58:25Z")

</div>

Oooof. I guess better than nothing, @Chr1sG. 🙂

Though, I thought the whole point of UUIDs would be that they should be universally unique? Guess it’s not guaranteed… 🤔

And with the whole idea of Fibery to be malleable, I hope this (presumable early-day design decision) one day can be rectified. 😻

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [July 22, 2023, 11:14am UTC](https://community.fibery.io/t/function-to-get-the-uri-of-an-entity/4824/8 "2023-07-22T11:14:27Z")

</div>

> [@njyo](#):
>
> And with the whole idea of Fibery to be malleable, I hope this (presumable early-day design decision) one day can be rectified

I think there’s little to no chance that the underlying tech design that UUID is only unique within a db is going to change.  
At the moment, I’m not aware of a strong case for changing (and enabling permalinks of the form `<instance>.fibery.io/<uuid>` instead of `<instance>.fibery.io/<dbid>/<uuid>` doesn’t seem like a big enough need imho).

---

<div class="post-metadata">

**Author:** ![njyo](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/njyo/32/923_2.png) [@njyo](https://community.fibery.io/u/njyo)\
**Post date:** [July 22, 2023, 11:24am UTC](https://community.fibery.io/t/function-to-get-the-uri-of-an-entity/4824/9 "2023-07-22T11:24:11Z")

</div>

As long as changes to the DB (renaming, moving, etc.) do not change the database ID, I guess it’s ok.

---

<div class="post-metadata">

**Author:** ![Inbar\_Assaf](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/inbar_assaf/32/9161_2.png) [@Inbar\_Assaf](https://community.fibery.io/u/Inbar_Assaf)\
**Post date:** [April 18, 2024, 7:05am UTC](https://community.fibery.io/t/function-to-get-the-uri-of-an-entity/4824/10 "2024-04-18T07:05:49Z")

</div>

> [@Chr1sG](#):
>
> At the moment, I’m not aware of a strong case for changing (and enabling permalinks of the form `<instance>.fibery.io/<uuid>` instead of `<instance>.fibery.io/<dbid>/<uuid>` doesn’t seem like a big enough need imho).

Was this implemented by any chance? Currently our entity links break if someone changes the space/ DB name.  
Is there a way to permanently link to an entity?

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [April 18, 2024, 10:53am UTC](https://community.fibery.io/t/function-to-get-the-uri-of-an-entity/4824/11 "2024-04-18T10:53:03Z")

</div>

> [@Inbar\_Assaf](#):
>
> Was this implemented by any chance? Currently our entity links break if someone changes the space/ DB name.  
> Is there a way to permanently link to an entity?

Nothing to report.

Tbh, it’s unusual for people to reference entities via URL, and even more unusual to have frequent changes to db names after creating references.
