<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
0D50Z00008G7UuKSAVOkta Classic EngineAdministrationAnswered2024-04-30T09:18:25.000Z2015-12-09T17:11:09.000Z2018-08-12T04:15:19.000Z
Assistance with a custom expression (Domain\FirstName.LastName)
Hello,

 

I'm new to custom expressions and I'm trying to create a custom expression for (DOMAIN\John.Smith). I looked at the following articles but couldn't get the expression to work. 

 

http://developer.okta.com/docs/api/getting_started/okta_expression_lang.html

 

https://support.okta.com/help/blogdetail?id=a67F0000000blN1IAI

 

FirstName: John

LastName: Smith

Domain: DOMAIN

 

Expected result: DOMAIN\John.Smith 

 

I've tried variations of: 

DOMAIN\${user.firstName}.${user.lastName}

 

Output:

DOMAIN​${user.firstName}.Smith

 

I can't seem to get the backslash to work. I think I should be using a string expression but I can't get those to work either. Any assistance would be greatly appreciated.

 

Thank you! 

 

Miran

  • j5v7c (j5v7c)

    Give this a shot.  i tested in my preview org and seems to get the correct results you may be looking for.  You should be able to copy and paste.  the DOMAIN is static so just replace that with whatever your domain name is.

     

    DOMAIN${"\"}${f:toLowerCase(user.firstName)}.${f:toLowerCase(user.lastName)}
    Selected as Best
  • Wils (Okta, Inc.)

    Hi Miran,

     

    It looks like that slash after DOMAIN (\) is trying to escape that dollar sign ($). In other words, the combination of the slash and dollar sign (\$) means a literal $ rather than a reference to the user variable. Try adding an extra slash so that instead of escaping the dollar sign, you'll escape the slash. So your expression should be something like:

      
    1.  DOMAIN\${user.firstName}.${user.lastName}
     

    Let me know if that doesn't work,

    Wils
    Expand Post
  • a9ogt (a9ogt)

    Hi Wils,

     

    Thanks for the quick response. I actually tried that and got the following result.

     

    DOMAIN\${user.firstName}.Smith

     

    I also tried the following string.  
    1.  String.append("DOMAIN\",${user.firstName}.${user.lastName})
     Result: 

    String.append("DOMAIN\",John.Smith)

     

    Please let me know if you have any other recommendations.
    Expand Post
  • Wils (Okta, Inc.)

    Miran,

     

    I have limited experience as well, so this is a hunch:

     

    From the support blog post (https://support.okta.com/help/blogdetail?id=a67F0000000blN1IAI) that you posted eariler, it looks like this ${ } provides the "expression container". Perhaps you can only have one of those per field? So maybe try: 
    1.  DOMAIN\user.$firstName.user.$lastName
     If you don't see the slash after "DOMAIN" add an extra slash to escape it. Similarly, if you don't see the dot (.) after the first name, try adding a slash.

     

    Let me know what you find,

    Wils

     

    UPDATE: forgot a dot
    Expand Post
  • Hey Miran,

     

    You might also try the String.join function:

     

    String.join("","DOMAIN\",source.firstName,".",source.lastName)
  • j5v7c (j5v7c)

    Give this a shot.  i tested in my preview org and seems to get the correct results you may be looking for.  You should be able to copy and paste.  the DOMAIN is static so just replace that with whatever your domain name is.

     

    DOMAIN${"\"}${f:toLowerCase(user.firstName)}.${f:toLowerCase(user.lastName)}
    Expand Post
    Selected as Best
  • a9ogt (a9ogt)

    Thank you Jeff!! That worked!
This question is closed.
Loading
Assistance with a custom expression (Domain\FirstName.LastName)