Lesson 2: Defining Relationships
In Steedos, understanding and utilizing object relationships is key to building effective and feature-rich custom applications. Object relationships allow different objects to be connected, enabling data association and integration. This tutorial will explain the concept and steps of object relationships through a simple application example — linking Todos object to Projects object.
1. Overview of Steedos Object Relationships
Object relationships play a crucial role in Steedos. They can be one of the following types:
- Master-Detail Relationship: This relationship is similar to the parent-child relationship in traditional databases. When the master object is deleted, the detail object is also deleted.
- Lookup Relationship: The lookup relationship is akin to a foreign key relationship in databases, allowing objects to remain independent but still connected.
- Many-to-Many Relationship: By defining relationship fields as array-type fields, a many-to-many relationship can be established between two objects.
2. Creating Todos and Projects Objects
In Steedos, you first need to create two custom objects: Todos and Projects.
- Log in to Steedos and go to “Settings”.
- In “Object Management”, select “New” to create Todos and Projects objects.
- Add necessary fields for each object. For example, Projects might include fields like “Project Name”, “Start Date”, and “End Date”; Todos might contain “Task Description”, “Due Date”, and “Status”.
3. Establishing Object Relationships
Taking Todos and Projects as examples, we can link them using either lookup relationships or master-detail relationships.
Lookup Relationship
- Under “Fields and Relationships” in the Todos object, select “New”.
- Choose “Lookup Relationship” and then select the Projects object as the related object.
- Complete the field settings and save. This way, each Todo can be linked to a specific project.
Master-Detail Relationship
- Repeat the steps above, but choose “Master-Detail Relationship” as the field type.
- Select Projects as the master object.
- This relationship means that if a project is deleted, all related Todos will also be deleted.
4. Utilizing Object Relationships
Once object relationships are established, they can be used within the application to enhance data management efficiency and user experience.
Data Integration
- In the Projects view, add a related list to display all associated Todos.
- In Todos records, show detailed information of the related Project.
Automation and Workflows
- In Projects, define roll-up summary fields to count the number of pending and total tasks, and further use formula fields to calculate the percentage of task progress.
- Configure workflow rules to automatically update the status of the Project when a Todo is completed.
Reporting and Dashboards
- Create comprehensive reports covering data from Projects and Todos.
- Use dashboards to visualize project progress and the completion of to-do items.
5. Testing and Adjustments
After creating object relationships, testing should be conducted to ensure everything works as expected.
- Add and modify Projects and Todos records to observe if the relationship fields are displayed correctly.
- Test the behavior of Todos records when a Projects record is deleted.
- Adjust field settings and page layouts based on test results.
Conclusion
By correctly setting up and using object relationships in Steedos, you can build powerful and efficient custom applications. In our example, the association between Todos and Projects not only helps organize data but also provides powerful tools for project management and task tracking. As you delve deeper into Steedos functionalities, you can continue to expand and optimize your applications to meet more complex business needs.