Updating user's "Other teams" via Custom API call (or adding them to a Team) | Community
Skip to main content
Level 4
August 16, 2024
Solved

Updating user's "Other teams" via Custom API call (or adding them to a Team)

  • August 16, 2024
  • 1 reply
  • 1000 views

Hi everyone,

 

I'm trying to update dynamically user's Teams ("Other teams", not home team) with custom API call as I can't find suitable default option neither in Update User module, nor Update Teams module.

 

I'm able to pull current user's team(s) and add a new team to the collection, but when I try to update user with this new value (collection), I get an error:

Any thought on how this can be resolved? Or maybe other ideas how I can either add certain users to the Team or add Team (as Other team) to certain users

 

I'd appreciate any suggestions

 

Thank you!

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

If you are still having problems with this, then here is how I do it.

 

  • Get the current teams membership for the user you want to update (under collections in builtin call, or include "fields: teams" on custom api call
  • Check if user is already in target team
  • Make a PUT call to the user you are wanting to add to the team.
  • In the body of the call, include this:

{"teams": [

  {this is all the users current teams},

  {"ID": "the ID of the new team you want to add"}]}

 

 

1 reply

lgaertner
Level 9
August 19, 2024

Hi,

 

as there seems to be no concrete action for any possible end point, I think you will need to work with a classical PUT request to the endpoint TEAMOB using the Custom API call module.

 

 

Therefore you have to send all team members again using this example payload:

 

 

{ 'teamMembers': [{ "userID": "<userID of first user>" }, { "userID": "<userID of second user>" }, { "userID": "<userID of third user>" }, ... ] }

 

 

Regards

Lars

vioviAuthor
Level 4
August 19, 2024

Thank you, I had similar approach, but the problem is that we have too many users that need to be added. It does not make much sense to list them manually here as I can just list them as team members in WF team itself (also manually).

I was thinking about automating this as users in the assignments may change and we may miss someone if we hard code the user list either via WF or Fusion.

The idea was to go through the project tasks assignments, pickup those who needs to be notified, filter out the duplicates and add them dynamically to the Team to notify.

 

 

ChrisStephens
Community Advisor
ChrisStephensCommunity AdvisorAccepted solution
Community Advisor
August 29, 2024

If you are still having problems with this, then here is how I do it.

 

  • Get the current teams membership for the user you want to update (under collections in builtin call, or include "fields: teams" on custom api call
  • Check if user is already in target team
  • Make a PUT call to the user you are wanting to add to the team.
  • In the body of the call, include this:

{"teams": [

  {this is all the users current teams},

  {"ID": "the ID of the new team you want to add"}]}