okta-sdk-java icon indicating copy to clipboard operation
okta-sdk-java copied to clipboard

Group creation with custom attributes failed

Open Marek26 opened this issue 9 months ago • 3 comments

Describe the bug?

The bug described here https://github.com/okta/okta-sdk-java/issues/1582 still exists.

Group creation with custom attributes is still failing in Version 21.

What is expected to happen?

Create a group with custom attributes should work as in previous SDK versions (v18).

What is the actual behavior?

API Error:

{
  "errorCode" : "E0000001",
  "errorSummary" : "Api validation failed: New UserGroup",
  "errorLink" : "E0000001",
  "errorId" : "oae14ET2_eqS_23M9-DSwRfig",
  "errorCauses" : [ {
    "errorSummary" : "Property name 'additionalProperties' is not defined in profile"
  } ]
}

Reproduction Steps?

// Create the new groups profile
final var oktaUserGroupProfile = new OktaUserGroupProfile();
oktaUserGroupProfile.setName("NewGroupName");
oktaUserGroupProfile.setDescription("My new groups description");
oktaUserGroupProfile.getAdditionalProperties().put("myAdditionalProperty", "myValue");

// Package the profile in an AddGroupRequest
final var addGroupRequest = new AddGroupRequest();
addGroupRequest.setProfile(oktaUserGroupProfile);

// Call okta to create the new group
final var createdGroup = groupApi.addGroup(group);

Additional Information?

No response

Java Version

21

SDK Version

21.0.0

OS version

No response

Marek26 avatar Mar 14 '25 09:03 Marek26

Hi @Marek26, thanks for reporting this! I will be taking a look at this.

prachi-okta avatar Mar 18 '25 09:03 prachi-okta

Hi @Marek26, I am currently working on this ticket. There is a pre-requisite - custom profile properties need to be set in your Org's Profile editor via Admin UI. Just wondering if you have already set that?

prachi-okta avatar Apr 10 '25 18:04 prachi-okta

@prachi-okta Yes, and creating a group using custom attributes is also working via API directly or with version 18 of this SDK.

I assume the SDK is trying to create a group using this payload: `{

{
  "profile": {
  "description": "All users West of The Rockies",
  "name": "West Coast users",
  "additionalProperties": {
     "additionalProperty1": "internal"
    }
  }
}

While this would be correct:

{
  "profile": {
    "description": "All users West of The Rockies"
    "name": "West Coast users",
    "additionalProperty1": "internal"
    }
}

Marek26 avatar Apr 10 '25 18:04 Marek26

@Marek26, yep, that seems to be the issue. I am currently working on this to ensure the models have the right datatype. Thanks for your patience!

prachi-okta avatar Apr 17 '25 06:04 prachi-okta

Hi @Marek26, you will be able to create the group now with custom attributes as long as they are added in the Profiles in the Group tab. I have added the fix and will be available with the next release. Thank you for your patience!

prachi-okta avatar Apr 30 '25 13:04 prachi-okta

Hi @Marek26, we have released a new version of the SDK which includes the fix for this issue. Do let us know if you are still facing an issue with the same. Thanks!

prachi-okta avatar May 05 '25 11:05 prachi-okta