custom username Skip to main content
https://support.okta.com/help/answers?id=9060z000000789uqaq&refurl=http%3a%2f%2fsupport.okta.com%2fhelp%2fanswers
How satisfied are you with the Okta Help Center?
Thank you for your feedback!
How satisfied are you with the Okta Help Center?
1
2
3
4
5
Very Dissatisfied
Very satisfied
Enter content less than 200 characters.
Ask Search:
Anne VercauterenAnne Vercauteren 

custom username

Hello,
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 avercauteren@cokecce.com and my user login is E71627@ge.coke.com. How can I have E71627@cokecce.com 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, '@')+"@cokecce.com"

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 (https://developer.okta.com/reference/okta_expression_language/)link.

Thank you, 
Vlad Ivascu