Data & Backend
Linked Objects
Linked Objects let you create relationships between data models, so records in one model can reference records in another. This is essential for building apps where data is interconnected — like tasks belonging to projects, or contacts linked to companies.
How Linked Objects Work
Linked Objects use the Link to Object field type to create bidirectional relationships between two data models. When you link a Task to a Project, the Project automatically knows about that Task — and vice versa.
Add a Link to Object Field
In your data model, add a field with the type Link to Object. Choose which other data model it should link to. For example, add a "Project" field to your Tasks model that links to the Projects model.
Bidirectional Links Are Created Automatically
When you link a Task to a Project, the relationship is created on both sides. The Task record stores a reference to the Project, and the Project record stores a reference back to the Task. This happens automatically through Webase's interceptor pipeline.
Use Links in Your App
Your app can display linked records in context. For example, on a Project detail page, show all linked Tasks. On a Task detail page, show which Project it belongs to. The AI sets this up automatically when you describe the relationship.
Automatic Sync via Interceptors
Webase uses an interceptor pipeline to keep linked records in sync:
- LinkedObjectUpdater — When you create or update a link, the corresponding record on the other side is automatically updated to reflect the relationship.
- LinkedObjectRemover — When you delete a record, all references to it in other models are cleaned up automatically. No orphaned links.
Example: If you delete a Project, all Tasks that were linked to it will have their Project reference cleared. The Tasks themselves are not deleted — only the link is removed.
Common Relationship Patterns
Here are some common ways to use Linked Objects in your apps:
- Tasks ↔ Projects — Each task belongs to a project, and each project has many tasks.
- Contacts ↔ Companies — Each contact works at a company, and each company has multiple contacts.
- Orders ↔ Customers — Each order is placed by a customer, and each customer has an order history.
- Students ↔ Courses — Students enroll in courses, and courses have enrolled students.
- Tickets ↔ Assignees — Support tickets are assigned to team members, and each member has assigned tickets.
Setting Up Links via Chat
The easiest way to create linked objects is through the chat panel. Describe the relationship you want in natural language:
- "Link tasks to projects so each task belongs to a project."
- "Add a Company field to the Contacts model that links to the Companies model."
- "Show all related tasks on the project detail page."
The AI will create the Link to Object fields, set up the bidirectional relationship, and update the UI to display linked records appropriately.