# How to get username in get user script?

**URL:** <https://community.auth0.com/t/how-to-get-username-in-get-user-script/96826>\
**Category:** Get Help\
**Tags:** other, admin-management, missing-category, dashboard\
**Created:** [December 20, 2022, 4:02pm UTC](https://community.auth0.com/t/how-to-get-username-in-get-user-script/96826 "2022-12-20T16:02:11Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [December 20, 2022, 7:50pm UTC](https://community.auth0.com/t/how-to-get-username-in-get-user-script/96826/3 "2022-12-20T19:50:36Z")

</div>

Hi @anish.subedi,

Thanks for reaching out to the Auth0 Community!

I understand that you like to know how to get the username in the Get User script in your Custom Database.

It appears that the discussion already has a solution:

> [@Username does not work for custom mongodb connection](https://community.auth0.com/t/username-does-not-work-for-custom-mongodb-connection/57637/2):
>
> Hi @raalrwai , The sample template is assuming you are using emails only, not usernames. When you enable “Requires Username”, you will need to add additional logic to your Custom DB scripts to be able to handle the email parameter being passed as either an email or a username, and be able to find the user correctly with either. In both cases, it should return the same profile, including the username in said profile so it can be stored in Auth0 (for import mode). This is mentioned in the [docs](https://auth0.com/docs/connections/database/custom-db/templates/get-user): …

Please let me know if you have any trouble with the implementation or need further clarification.

Thanks,  
Rueben

---

_[View the full topic](https://community.auth0.com/t/how-to-get-username-in-get-user-script/96826)._
