Guest User

Testing customSchemas

a guest
Nov 26th, 2024
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. function updateUser() {
  2. // update individual user, given email, to make Site Code match buildingId
  3. const user1Email = "[email protected]";
  4. const user2Email = '[email protected]';
  5. try {
  6. var user = AdminDirectory.Users.get(user2Email,{projection: 'custom',customFieldMask: 'Site_Code'});
  7. //user.customSchemas.User_Information.Site_Code = user.locations[0].buildingId;
  8. //AdminDirectory.Users.update(user, userEmail);
  9. AdminDirectory.Users.update({
  10. 'customSchemas': {
  11. 'User_Information': {
  12. 'Site_Code': [
  13. { value: 'blooptest', type: 'work' },
  14. ]
  15. }
  16. }
  17. },
  18. user1Email
  19. )
  20. Logger.log("user1: " + user.primaryEmail + "," + user.locations[0].buildingId + "," + user.customSchemas.User_Information.Site_Code);
  21. } catch (err) {
  22. // TODO (developer)- Handle exception from the API
  23. console.log('Failed with error %s', err.message);
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment