Update Other Groups in User Object | Community
Skip to main content
_Manish_Singh
Level 9
August 15, 2023
Solved

Update Other Groups in User Object

  • August 15, 2023
  • 1 reply
  • 875 views

I am trying to add newly created groups to the 'Other Groups' field in the user profiles for 350+ users. I have not been able to find the correct API call or Workfront module to do this. Could someone help me get started with this please?

Note: I'm not trying to replace/delete the existing groups in the other groups, just want to add the new ones.

Example:

IDAdd to Other Groups
User1CS-SE
User2CS-SE
User3CS-TS
User4CS-LSA
User5CS-SE
User6CS-LSA
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by ChrisStephens
  1. Pull in current userGroups array of collections for user
  2. Create array of collections for groups you want to add, JSON should look like this (or similar, I did this off memory, sorry):

 

{ "userGroups":[ "groupID": "group ID 1" ],[ "groupID": "group ID 2" ] }

 

  • Merge array from step 1 with array from step 2
  • PUT your new array back on to the user object

1 reply

ChrisStephens
Community Advisor
ChrisStephensCommunity AdvisorAccepted solution
Community Advisor
August 15, 2023
  1. Pull in current userGroups array of collections for user
  2. Create array of collections for groups you want to add, JSON should look like this (or similar, I did this off memory, sorry):

 

{ "userGroups":[ "groupID": "group ID 1" ],[ "groupID": "group ID 2" ] }

 

  • Merge array from step 1 with array from step 2
  • PUT your new array back on to the user object
_Manish_Singh
Level 9
August 15, 2023

Thanks @chrisstephens - I was able to merge the arrays. Could you help me with step 4 please? I'm using a PUT call, but I'm not confident if I'm doing it right. I shared a screenshot for the reference below.

Step 3: Merge successful 👍


Step 4: PUT call, I'm obtaining "4.ID" (user id) from Workfront search module.

ChrisStephens
Community Advisor
Community Advisor
August 15, 2023

That's not correct.

 

You need a create JSON module, and use the JSON string from my previous comment to make the structure, then map your merged array into the array field, then the JSON string needs to go in the PUT calls body.