Guest User

Untitled

a guest
Jul 24th, 2018
532
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. {"Contact.Account", "001230942830"},
  2. {"Contact.Email", "theEmail@gmail.com"},
  3. {"Contact.FirstName", "theFirstName"},
  4. {"Contact.LastName", "theLastName"},
  5. {"User.Email", "theEmail@gmail.com"},
  6. {"User.UserName", "theEmail@gmail.com"},
  7. {"User.FirstName", "theFirstName"},
  8. {"User.LastName", "theLastName"},
  9. {"User.Alias", "theAlias"},
  10. {"User.ProfileId", _profileID}
  11.  
  12. /*
  13. * If you are updating Contact or Account object fields, you cannot update the following User fields at the same time.
  14. * If your identity provider sends these User fields as attributes along with Contact
  15. * or Account fields, you must modify the logic in this class to update either these
  16. * User fields or the Contact and Account fields.
  17. */
  18. if(attributes.containsKey('User.IsActive')) {
  19. String IsActiveVal = attributes.get('User.IsActive');
  20. u.IsActive = '1'.equals(IsActiveVal) || Boolean.valueOf(IsActiveVal);
  21. }
  22. if(attributes.containsKey('User.ForecastEnabled')) {
  23. String ForecastEnabledVal = attributes.get('User.ForecastEnabled');
  24. u.ForecastEnabled = '1'.equals(ForecastEnabledVal) || Boolean.valueOf(ForecastEnabledVal);
  25. }
  26. if(attributes.containsKey('User.ProfileId')) {
  27. String profileId = attributes.get('User.ProfileId');
  28. Profile p = [SELECT Id FROM Profile WHERE Id=:profileId];
  29. u.ProfileId = p.Id;
  30. }
  31. if(attributes.containsKey('User.UserRoleId')) {
  32. String userRole = attributes.get('User.UserRoleId');
  33. UserRole r = [SELECT Id FROM UserRole WHERE Id=:userRole];
  34. u.UserRoleId = r.Id;
  35. }
Add Comment
Please, Sign In to add comment