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

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

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.


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?