Issue Symptoms
When working with integrations, sometimes you need to sync all your end users from your internal directory with Zendesk and eventually assign them to the correct "default" organization.
Sometimes during the syncing process, end users belonging to multiple organizations may lose their membership and get directly assigned to the default organization. This may not be the expected result. Ideally, the user should keep the membership for all his or her current organizations, with only the default one changing.
So how do you set the default organization for an existing user without clearing out the multiple organizations the user already belongs to?
Conditions
- You are an agent of your Zendesk account.
- You have access to the API, and possess valid credentials to leverage the endpoints.
Resolution
To set the default organization for a given user and avoid changing any existing relationship with other organizations the user belongs to, use the Organization Memberships API, particularly the Set Membership as Default endpoint.
You'll need the membership_id key for the default organization to run the API request. You can find it using the List Membership endpoint.
2 Comments
Hi Zendesk.
Thank you for this article.
Is it possible to do it for many at the same time ?
Today i have more than 30 000 users to update to set the Org as default, because the have multiple, but the one used on triggers is not default and do not work on triggers.
So i would like to update like 100 at a time. is it possible ?
Thank you
Hello Matthieu,
Unfortunately the endpoint does not support bulk updates capabilities.
For such a great dataset, I would definitely consider designing an automation, perhaps a script, that could hit the endpoint recursively and perform the updates in that way.
For inspirational and instructional purposes, I can suggest taking a look at this tutorial on how to retrieve large dataset using Python. It's not exactly what you need, but the same approach could be customised to fit your business case.
Best
Please sign in to leave a comment.