<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
0D5KZ000010W5Z80AKOkta Classic EngineDirectoriesAnswered2025-07-31T15:10:34.000Z2025-07-15T13:58:38.000Z2025-07-31T15:10:34.000Z

DoganA.57760 (Customer) asked a question.

Using Okta Expression Language in Profile Editor Mappings

Hello,

 

I am trying to setup a mapping rule using Okta Expression Language for a specific field, and currently encountering an issue when using the user.getGroups() function, it seems to not be available/supported in this context while supposedly possible when reading the documentation page :

https://developer.okta.com/docs/reference/okta-expression-language/*popular-expressions:~:text=Note%3A%20The%20user.getGroups%20function%20was%20previously%20only%20available%20for%20a%20limited%20set%20of%20features%20on%20Okta%20Identity%20Engine%2C%20but%20has%20been%20expanded%20to%20all%20features%20that%20allow%20Expression%20Language.

/help/servlet/rtaImage?refid=0EMKZ000000dL0c

 

I do not observe this behaviour with other functions;

/help/servlet/rtaImage?refid=0EMKZ000000dL0h


  • HarryL.05482 (Anthropic Identity)

    Got it! If it is a SAML application, you could add the expression language as a SAML Attribute which may work better. That way when a user logs in, it sends the groups in the SAML assertion. This also depends if this works for your application.

     

    To do this: you would go to the Application in Okta, navigate to the "Authentication" tab, select edit, go under the SAML 2.0 configuration and add group attribute statements or attribute statements.

    Expand Post
    Selected as Best
  • HarryL.05482 (Anthropic Identity)

    Hey Dogan - It seems your expression isn't written correctly. Are you trying to list all the groups a user is assigned to? Or what exactly is your use case?

  • HarryL.05482 (Anthropic Identity)

    This expression for example would return a string of users groups, filtered to 100: getFilteredGroups(".*", 100)

     

  • DoganA.57760 (Customer)

    Hello @HarryL.05482 (Anthropic Identity)​,

    Here is what I had inputed in the field: user.getGroups()[0].id

    It was a simplified use case of what I was trying to do in order to replicate the issue easily. So it should return the id of the first group of the user.

     

    What I am trying to achieve, is to get all the Group names a user is assigned to, and join them with quotes;

    e.g; User John Doe has groups Editor and Admin - expected result => Editor,Admin )

    Expand Post
    • HarryL.05482 (Anthropic Identity)

      What is the actual use case ? Are you looking to send all the groups a user has to an application? SAML Assertion? Or you just want this as a part of their profile?

      • DoganA.57760 (Customer)

        Yes the point is to send the Groups to an application, the mapping rule is set to populate a custom field on an OIN User Profile, which is used for SCIM/user provisioning.

         

        Groups in Okta are mapped to "teams" in my integrated app. Users can have multiple teams

         

         

        Expand Post
      • HarryL.05482 (Anthropic Identity)

        Got it! If it is a SAML application, you could add the expression language as a SAML Attribute which may work better. That way when a user logs in, it sends the groups in the SAML assertion. This also depends if this works for your application.

         

        To do this: you would go to the Application in Okta, navigate to the "Authentication" tab, select edit, go under the SAML 2.0 configuration and add group attribute statements or attribute statements.

        Expand Post
        Selected as Best
This question is closed.
Loading
Using Okta Expression Language in Profile Editor Mappings