How can I create a relation with the same entity?

I wanna create the parent relation (it's a property) inside property, how can I do that? When I run the upgrade command it's throwing with [Nest] 34073 - 06/12/2025, 9:32:03 PM ERROR [WorkspaceSyncMetadataService] Sync of standard objects failed with: [Nest] 34073 - 06/12/2025, 9:32:03 PM ERROR [WorkspaceSyncMetadataService] Error: Join column for parent relation is present on both sides
No description
11 Replies
Prastoin
Prastoin3mo ago
Hello @Mauricio Natacci, I'm not sure to understand what you're trying to do Couldn't you configure custom object data model using custom relation fields ?
Mauricio Natacci
Mauricio NatacciOP3mo ago
Hello @prastoin how's it going? I wanna add a relation between the same entity. an abstract example: Person...A person can be a father or a son, so to make this possible I need to relate the person to itself. how can I do this (relate an entity to itself)?
Prastoin
Prastoin3mo ago
Hey @Mauricio Natacci ! good what about you ? Unless I'm mistaken you should be able to find you way using the existing custom relation from the GUI ! Something like that
No description
Mauricio Natacci
Mauricio NatacciOP3mo ago
Pretty good! Thanks for asking! Yup, but what about in the code? because if I add on the UI, it will only exist in that workspace, you know?! So I would like adding in the code to apply for any existing workspaces... as you can see in the image, when I try to add directly in the code it's throwing (however, when I create on the UI, it works...but I need to make it work adding in the entity) does that make more sense now @prastoin ?
Prastoin
Prastoin3mo ago
How many workspaces are you working with ? nor how often to you need to re-create object model on the fly ? I don't think this would be worth it for you to have a custom fork to statically add something that could be configured dynamically using a script hitting the API for all your workspaces object metadata on which you wanna have a relation to itself
Mauricio Natacci
Mauricio NatacciOP3mo ago
I don't have a lot of workspaces right now but I would like in the future when my clients create workspaces, this field already exists
Prastoin
Prastoin3mo ago
Ok ! Indeed sounds legitimate FYI we should be introducing the very first Twenty as code configurations files for object metadata and high level architecture in September 2025 From there you have several possibilities: - Create a script that will hit the API in order to create all your expected initial object metadata and fields - Create them manually each time - Modify the source code ( this means that ALL your object metadata models would have a self relation )
Mauricio Natacci
Mauricio NatacciOP3mo ago
Great! Got it Is there any difference/disadvantage in using a script to create something that doesn't exist in the entity?
Prastoin
Prastoin3mo ago
I would say maintainability ! as modifiying the source code means having a custom build of twenty Whereas this could be done through the API programmatically I would opt for the most low cost tradeof
Mauricio Natacci
Mauricio NatacciOP3mo ago
Got it! thanks a lot @prastoin 🙏
Prastoin
Prastoin3mo ago
Yw ! Feel free to reach out with your script ! Have a great day

Did you find this page helpful?