Cannot publish multi-tenant global document because "Assigned Tenant" is empty and disabled
Closed this issue · 6 comments
Describe the Bug
The problem
If you are using multi-tenant plugin and try to create a collection marked with isGlobal: true in the config you will not be able to do so on account with userHasAccessToAllTenants: true. For some reason when the global collection is created "Assigned Tenant" default value is not set to the tenant you are currently on. To make things even worse the "Assigned Tenant" field is also disabled by default so you are unable to publish the collection at all from the account with userHasAccessToAllTenants: true.
Video
Here is the video of the described issue. I am trying to create a Layout document which is marked with isGlobal: true in my @payload/multi-tenant-plugin config. The only mistake I did in the video is that I didn't select the top right tenant field to be "New Tenant", but I've confirmed that doing so does not fix the problem or set the "Assigned Tenant" value to the selected tenant.
2025-09-10.19-31-17.mp4
As you can see global collections become useless for the "super admin" user, since you aren't be able to create them from such account.
Workaround
I've also found the hacky workaround which may help you triangulate the issue, but I am fairly certain that the problem is a lack of generator function for the default value of "Assigned Tenant" field or at least the option for the field to not be disabled on isGlobal: true collections. Either way the hack is to publish the document by creating a new user with userHasAccessToAllTenants: false and add it to the tenant where you want to create the global collection on. This way the admin does not show the "Asssigned Tenant" field and you are able to publish the document normally.
Link to the code that reproduces this issue
.
Reproduction Steps
- Create payload app
- Add multi-tenant plugin and configuration
- Add a collection marked with
isGlobal: true - Set
userHasAccessToAllTenants: truefor the user - Try to create/publish a global collection
- You will end up with the issue described above where the "Assigned Tenant" field is empty, while the UI blocks the publish request due to it requiring a value which you are not able to set due to the field being disabled
Which area(s) are affected? (Select all that apply)
plugin: multi-tenant
Environment Info
Binaries:
Node: 22.14.0
npm: N/A
Yarn: N/A
pnpm: 10.5.2
Relevant Packages:
payload: 3.55.0
next: 15.5.2
@payloadcms/db-postgres: 3.55.0
@payloadcms/email-nodemailer: 3.55.0
@payloadcms/graphql: 3.55.0
@payloadcms/live-preview: 3.55.0
@payloadcms/live-preview-react: 3.55.0
@payloadcms/next/utilities: 3.55.0
@payloadcms/payload-cloud: 3.55.0
@payloadcms/plugin-cloud-storage: 3.55.0
@payloadcms/plugin-multi-tenant: 3.55.0
@payloadcms/plugin-seo: 3.55.0
@payloadcms/richtext-lexical: 3.55.0
@payloadcms/storage-s3: 3.55.0
@payloadcms/translations: 3.55.0
@payloadcms/ui/shared: 3.55.0
react: 19.1.1
react-dom: 19.1.1
Operating System:
Platform: win32
Arch: x64
Version: Windows 11 Pro
Available memory (MB): 32689
Available CPU cores: 16
Please add a reproduction in order for us to be able to investigate.
Depending on the quality of reproduction steps, this issue may be closed if no reproduction is provided.
Why was this issue marked with the invalid-reproduction label?
To be able to investigate, we need access to a reproduction to identify what triggered the issue. We prefer a link to a public GitHub repository created with create-payload-app@latest -t blank or a forked/branched version of this repository with tests added (more info in the reproduction-guide).
To make sure the issue is resolved as quickly as possible, please make sure that the reproduction is as minimal as possible. This means that you should remove unnecessary code, files, and dependencies that do not contribute to the issue. Ensure your reproduction does not depend on secrets, 3rd party registries, private dependencies, or any other data that cannot be made public. Avoid a reproduction including a whole monorepo (unless relevant to the issue). The easier it is to reproduce the issue, the quicker we can help.
Please test your reproduction against the latest version of Payload to make sure your issue has not already been fixed.
I added a link, why was it still marked?
Ensure the link is pointing to a codebase that is accessible (e.g. not a private repository). "example.com", "n/a", "will add later", etc. are not acceptable links -- we need to see a public codebase. See the above section for accepted links.
Useful Resources
Hi @simovicaleksa , I'm encountering an issue with the multi-tenant plugin when using isGlobal: true collections: the "Assigned Tenant" field is either not visible or is disabled, but its validation still prevents documents from being published, especially when userHasAccessToAllTenants: true. Through my debugging, I've observed that the plugin does add this field to the collection's configuration internally, but it's not being rendered in the admin UI for global collections.
Could you please provide a minimal reproduction repository that demonstrates a working setup for global collections with the multi-tenant plugin, as this would greatly help me understand why the "Assigned Tenant" field isn't rendering correctly? Thanks!
For reference this is my repository on which I tried reproducing the issue - https://github.com/imsidkg/test-payload
Hey got similar type of issue the only thing different for me is I can see only the tenant attached to me, I cant see all the available tenants even being a super-admin. I want to be able to assign any tenant I want.
This is an issue only when using the PG adapter, good find! PR with fix is here.
Yeah the UX is not my favorite, but for globals, since you can only have 1 document per tenant we don't allow you to set them directly on the document view. Instead you need to use the global selector which will "filter" the current global by the selected tenant.
So the intention is that you would use the global tenant selector to change the tenant-global document you are viewing.
This issue has been automatically locked.
Please open a new issue if this issue persists with any additional detail.
🚀 This is included in version v3.57.0