Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting Attribute Values? #49

Closed
basement199 opened this issue Jan 27, 2017 · 2 comments
Closed

Setting Attribute Values? #49

basement199 opened this issue Jan 27, 2017 · 2 comments

Comments

@basement199
Copy link

Hi,

I need to create some users and I need to populate profile attributes other than the standard (firstname,lastname,email,login). Is it possible to do this withe API?

For example I need to populate the employeeNumber attribute.

thanks,
Freeman

@FortisJoe
Copy link

FortisJoe commented Jan 30, 2017

Hello Freeman,

I have managed this in the past using the following code:

private User createUserFromEmployee(Employee employee) {
   User user = new User();
   UserProfile userProfile = new UserProfile();
   userProfile.setEmail(employee.getEmailAddress());
   userProfile.setFirstName(employee.getFirstName());
   userProfile.setLastName(employee.getLastName());
   userProfile.setLogin(employee.getEmailAddress());
   Map<String,Object> unmapped = userProfile.getUnmapped();
   unmapped.put("employeeNumber", employee.getEmployeeNumber());
   user.setProfile(userProfile);
   return user;
}

Hope this helps,

Joe

@basement199
Copy link
Author

Hi Joe,

That worked! Appreciate the tip.

thanks,
Freeman

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants