custom username Skip to main content
How satisfied are you with the Okta Help Center?
Thank you for your feedback!
How satisfied are you with the Okta Help Center?
Very Dissatisfied
Very satisfied
Enter content less than 200 characters.
Ask Search:
Anne VercauterenAnne Vercauteren 

custom username

Trying to get a custom expression setup for the username field. How can I have the the string before the "@" form the email address replaced with the first part of the user.login?
example:my email address is and my user login is How can I have as custom username?
Thank you.
Vlad IvascuVlad Ivascu (Okta, Inc.)
Hello Anne, 

In order to achieve this you will have to create the custom mapping using Profile Editor for your application. 
To do this login to your Admin Dashboard in Okta, navigate to Directory>Profile Editor>Application. Once you are on the Profile Editor for your application click on Mapp attributes, switch to the Okta to "Application" view and for the username click on Override with mapping and use the expression below. 
Before applying the expression you can preview this mapping for a user in the lower left side of the profile mappings window.
substringBefore(user.login, '@')+""

Please note you have 2 options to select from when applying this mapping. One is to "Apply mapping on user create only" and the other is "Apply mapping on user create and update". If you select the first one, any user currently assigned to the application will have to be unassigned and re-assigned back to the app for the "new" username to be applied. 
If you select the second option, if there are any updates to your users, the application username will be automatically updated to the new login. 

You can review our Okta Expression Language documentation for additional information on other expressions by going to this (

Thank you, 
Vlad Ivascu