<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
Convert the Domain in Email Based Usernames Using Expression Language
Okta Classic Engine
Okta Identity Engine
Single Sign-On
Overview

This article describes how to use Okta Expression Language (EL) to convert an email-based username from one domain to another (for example, username@domain1.com to username@domain2.com). It clarifies the process of replacing specific string patterns within a user attribute to modify the application username format.

Applies To
  • Okta Expression Language
  • Application Username Format - Custom
  • Single Sign-On (SSO)
Solution

Follow the video or the steps below:

To convert a username such as "jdoe@example1.com" to "jdoe@example2.com", use the String.replace expression.

  1. Navigate to the application settings.
  2. Locate the Application username format field.
  3. Select Custom from the dropdown menu.
  4. Enter the following expression into the field: String.replace(user.email, "example1", "example2").
  5. Save the changes.

NOTE: The syntax for this function is String.replace(Attribute, match, replacement).

Related References

Loading
Convert the Domain in Email Based Usernames Using Expression Language