Expand my Community achievements bar.

Latest Community Ideas Review is Out: Discover What’s New and What to Expect!

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

Avatar

Level 4

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:

Screenshot 2024-08-16 143032.png

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!

3 Replies

Avatar

Level 10

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

Avatar

Level 4

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.

 

 

Avatar

Community Advisor

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"}]}