# Documentation is wrong about changing user in rules

**URL:** <https://community.auth0.com/t/documentation-is-wrong-about-changing-user-in-rules/10654>\
**Category:** Get Help\
**Created:** [April 5, 2018, 9:22am UTC](https://community.auth0.com/t/documentation-is-wrong-about-changing-user-in-rules/10654 "2018-04-05T09:22:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomyam](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/tomyam/32/7901_2.png) [@tomyam](https://community.auth0.com/u/tomyam)\
**Post date:** [April 5, 2018, 9:22am UTC](https://community.auth0.com/t/documentation-is-wrong-about-changing-user-in-rules/10654/1 "2018-04-05T09:22:08Z")

</div>

We use account linking in a rule and change the primary user.

The docs says you need to set `context.primaryUser` to the id the user got linked into.  
[https://github.com/auth0/rules/blob/master/rules/link-users-by-email.md](https://github.com/auth0/rules/blob/master/rules/link-users-by-email.md)

> **[User Account Linking - Auth0 Docs](https://auth0.com/docs/manage-users/user-accounts/user-account-linking)**
>
> Understand how user accounts can be linked in Auth0 from various identity providers.

But, when doing just that the next rule still uses the previous user (which by now is non-existent, because it was linked into another user).

After trial and error it seems you also need to call the rule callback with the other user, i.e. the user the original user got linked into.

Please revisit this.

---

<div class="post-metadata">

**Author:** ![kimcodes](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/kimcodes/32/81052_2.png) [@kimcodes](https://community.auth0.com/u/kimcodes)\
**Post date:** [April 5, 2018, 6:48pm UTC](https://community.auth0.com/t/documentation-is-wrong-about-changing-user-in-rules/10654/2 "2018-04-05T18:48:04Z")

</div>

A post was merged into an existing topic: [Sign in not documented when changing primary user in a rule](https://community.auth0.com/t/sign-in-not-documented-when-changing-primary-user-in-a-rule/10655)

---

<div class="post-metadata">

**Author:** ![kimcodes](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/kimcodes/32/81052_2.png) [@kimcodes](https://community.auth0.com/u/kimcodes)\
**Post date:** [April 5, 2018, 6:48pm UTC](https://community.auth0.com/t/documentation-is-wrong-about-changing-user-in-rules/10654/3 "2018-04-05T18:48:04Z")

</div>


