# Help converting a rule to an action

**URL:** <https://community.auth0.com/t/help-converting-a-rule-to-an-action/118967>\
**Category:** Get Help\
**Tags:** extensibility, actions-extensibility\
**Created:** [October 19, 2023, 9:20pm UTC](https://community.auth0.com/t/help-converting-a-rule-to-an-action/118967 "2023-10-19T21:20:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![j.montgomery](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@j.montgomery](https://community.auth0.com/u/j.montgomery)\
**Post date:** [October 19, 2023, 9:20pm UTC](https://community.auth0.com/t/help-converting-a-rule-to-an-action/118967/1 "2023-10-19T21:20:54Z")

</div>

I am trying to answer the same question as this commenter: [Convert rules to action help](https://community.auth0.com/t/convert-rules-to-action-help/109394)

For certain flows I want to map either user.email or user.upn to a custom email claim in the ID token that my app uses in lieu of email in some cases. How do I access user.upn? I have been reading the documentation and it seems like the previous limitation has been removed but I still cannot find a clear way to access the UPN attribute.

```auto
function (user, context, callback) {
  const namespace = "https://example.com/"
  context.idToken[namespace + 'email'] = user.email || user.upn;
  callback(null, user, context);
}

```

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [January 8, 2024, 9:28am UTC](https://community.auth0.com/t/help-converting-a-rule-to-an-action/118967/3 "2024-01-08T09:28:18Z")

</div>

Hey there!

As this topic is related to Rules - Hooks - Actions and Rules & Hooks are being deprecated soon I’m excited to let you know about our next [Ask me Anything session in the Forum on Thursday, January 18 with the Rules, Hooks and Actions team](https://community.auth0.com/t/auth0-community-ask-me-anything-rules-hooks-and-why-actions-matter/124043) on Rules & Hooks and why Actions matter! Submit your questions in the thread above and our esteemed product experts will provide written answers on January 18. Find out more about Rules & Hooks and why Actions matter! Can’t wait to see you there!

[Learn more here!](https://community.auth0.com/t/auth0-community-ask-me-anything-rules-hooks-and-why-actions-matter/124043)

---

<div class="post-metadata">

**Author:** ![dawid.matuszczyk](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dawid.matuszczyk/32/74550_2.png) [@dawid.matuszczyk](https://community.auth0.com/u/dawid.matuszczyk)\
**Post date:** [October 18, 2024, 8:51am UTC](https://community.auth0.com/t/help-converting-a-rule-to-an-action/118967/4 "2024-10-18T08:51:18Z")

</div>

Hi @j.montgomery

Welcome to the Auth0 Community!

We’ve updated our Knowledge Solutions with chapter about Adding Claims with Action with a similar fashion to how Rules worked. You can find it here → [Azure AD Integration not Providing the User Email](https://community.auth0.com/t/azure-ad-integration-not-providing-the-user-email/88924#p-236269-add-claims-using-actions-6)

Thanks  
Dawid

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [November 1, 2024, 8:51am UTC](https://community.auth0.com/t/help-converting-a-rule-to-an-action/118967/5 "2024-11-01T08:51:18Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
