# Get an Email Address from Asigness or Userid (Action Button)

**URL:** <https://community.fibery.io/t/get-an-email-address-from-asigness-or-userid-action-button/485>\
**Category:** API & Programming\
**Created:** [December 27, 2019, 1:15am UTC](https://community.fibery.io/t/get-an-email-address-from-asigness-or-userid-action-button/485 "2019-12-27T01:15:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fabien](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/fabien/32/381_2.png) [@Fabien](https://community.fibery.io/u/Fabien)\
**Post date:** [December 27, 2019, 1:15am UTC](https://community.fibery.io/t/get-an-email-address-from-asigness-or-userid-action-button/485/1 "2019-12-27T01:15:21Z")

</div>

Get an Email Address from Asigness or Userid (Action Button)

---

<div class="post-metadata">

**Author:** ![Sergey\_Truhtanov](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/sergey_truhtanov/32/13986_2.png) [@Sergey\_Truhtanov](https://community.fibery.io/u/Sergey_Truhtanov)\
**Post date:** [December 27, 2019, 1:13pm UTC](https://community.fibery.io/t/get-an-email-address-from-asigness-or-userid-action-button/485/2 "2019-12-27T13:13:56Z")

</div>

Hello.

Here is the code for action button, that prints emails with id of assignees to browser console. Press button and see output in console.

```auto

async function getAssigneesSlackIds(type, id) {
    const entity = await api.getEntityById(type, id, ["Assignees"]);
    return api.getEntitiesByIds('User', entity["Assignees"].map(a => a.id), ["Email"]);
}

for (const entity of args.currentEntities) {
    const assigneesWithEmails = await getAssigneesSlackIds(entity.type, entity.id);

    console.log(assigneesWithEmails);
}

```

Does it suits your needs?
