Add Record Relation
This node creates a relationship between two records.
The Add Record Relation node links two database entries, typically for many-to-many or one-to-many relationships.
The Add Record Relation node adds a reference to a target record into a relation column of a source record. For example, adding a "User" to a "Group's" members relation.
Inputs
General
| Data | Description |
|---|---|
| Class | The collection of the source record. |
| Record Id | The ID of the source record (the one that has the relation column). |
| Relation Property | The name of the relation column (e.g., "members", "likedBy"). |
| Target Record Id | The ID of the record to add to the relation. |
Actions
| Signal | Description |
|---|---|
| Do | Triggers the operation. |
Outputs
Events
| Signal | Description |
|---|---|
| Success | Triggered when the relation is added. |
| Failure | Triggered if the operation fails. |
Usage
Liking a Post
- Class: "Posts".
- Record Id: The ID of the post being liked.
- Relation Property: "likes" (a relation to Users).
- Target Record Id: The current user's ID.
- Trigger Do.
Detailed Behavior
- Backend: Sends a request to add the pointer/relation.
- Updates: The source record is updated locally to reflect the new relation count or state.
Troubleshooting
- Invalid Property: Ensure Relation Property matches the column name in the database schema exactly.