<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
0D51Y000091JNKESA4Okta Classic EngineLifecycle ManagementAnswered2024-06-02T09:07:40.000Z2020-07-23T01:49:08.000Z2020-07-31T00:47:27.000Z

2qvnr (2qvnr) asked a question.

Custom Username Format Using Okta Expressions

We are using Workday as a master and looking to generate the email for newly provisioned Okta users that will follow a firstName.lastName@domain.com format.

 

We have a few different domains that are used based on role and location and have custom expression that is working as expected for the most part and enforces lower case as well on the email address.

 

It is essentially this: String.toLowerCase(appuser.firstName) + "." + String.toLowerCase(appuser.lastName) + "@domain.com"

 

Occasionally we'll have a pre-hire come through from Workday that has an apostrophe in their last name or may have a space in their last name (maiden name + last name) and this causes a problem for generating a valid email address.

 

I'm not well versed in the Okta expression language and can't figure out how to generate an expression that will enforce lower case and strip out apostrophes and spaces from lastName.

 

Anyone have any tips?


  • dan.pica1.5688106778179905E12 (Vendor Management)

    Hello Andre,

     

    My name is Dan and I am from Okta Support.

     

    - You can use this expression to enforce lower case/ strip out apostrophe and spaces from last name:

    String.toLowerCase(appuser.firstName) + "." + String.removeSpaces(String.replace(String.toLowerCase(appuser.lastName), "'","")) + "@domain.com"

     

    - If you need, you can use this expression to apply it to both first name and last name:

    String.removeSpaces(String.replace(String.toLowerCase(appuser.firstName) + "." + String.toLowerCase(appuser.lastName), "'","")) + "@domain.com"

     

    Regards,

    Dan

    Expand Post
  • 2qvnr (2qvnr)

    Thank you - this is just what I needed and appreciate the additional explanation of applying it to first and last name.

This question is closed.
Loading
Custom Username Format Using Okta Expressions