Create new user with Country

I want to create a user with Country.Below is the code.

I do not see a member for country in the UserProfile class. Link for available methods
https://developer.okta.com/okta-sdk-java/apidocs/index.html?com/okta/sdk/resource/user/UserProfile.html

// Create a user with the specified password
var vader = await client.Users.CreateUserAsync(new CreateUserWithPasswordOptions
{
// User profile object
Profile = new UserProfile
{
FirstName = “Test1”,
LastName = “Okta”,
Email = "test1.okta@abc.com",
Login = "test1.okta@abc.com",
Country = “United States”, //error - ‘UserProfile’ does not contain method definition for country
SecondEmail ="test2.okta@abc.com",
MobilePhone = “1234567890”
},
Password = “aasdhaweq”,
Activate = false,
});

Can someone advise?

You need to update the user profile with a custom attribute.
You can either do it through API - https://developer.okta.com/docs/api/resources/schemas#add-property-to-user-profile-schema

Or you can login as admin to your org and navigate to Users -> Profile Editor and click on profile to add new property.

Hi Vijet, I have the country already in the profile Schema. The problem I am facing is with the UserProfile api .

when I am creating the user through my code I can’t find the method for Country on the UserProfile. UserProfile has only these:
Email
FirstName
LastName
Login
MobilePhone
SecondEmail

Hi @amarvemula,

If I am not wrong, you need to use the UserBuilder Class in the Java SDK.