Building integrations

How do I email the user picked in a user field or the step's assignee?

Add the User details connector's Get user data action, map the user's ID, select Email address, then map the returned email into the To field.

Fix

Short answer: A user field holds a user reference, not an email address. Add Get user data before the email step to turn the user's ID into an email, then map that email into To.

Why it happens

  • The To field of Send an email needs an email address as text.
  • Mapping a user field directly leaves To greyed out, or the run fails with errors such as "Insufficient arguments" or "mandatory: To".

How to fix it

  1. Before the email step, add the User details connector action Get user data.
  2. In User IDs, map the user's ID, for example the _id of the user field.
  3. In the user fields list, select Email address.
  4. In Send an email, map the email returned by Get user data into To.
  5. Test the action, then turn on the integration.

To email the assignee of the step the item just entered:

  1. Use the trigger When an item enters this step.
  2. In Get user data, map the ID from the current context's Assigned to list.
  3. Don't use the current assignee field with this trigger. It can return the previous step's assignee, often the initiator.

If the email can be empty, add a condition to the email action so it runs only when the address isn't blank.

If "mandatory: To" errors continue, refresh the Get user data step and check its connection.

If you change the user field, for example to allow multiple users, open the trigger, click Refresh fields, retest, and remap Get user data.

To branch on who created the item, fetch _created_by with Get user data and add a condition on the name or email.

Tip

The same pattern works for Slack: use the email from Get user data in Slack's Find a user by email action.

Related answers