Episode #5 - Joining your data in happy relationships
Welcome back, Low Coders! Way back in Episode 1, we created several objects — the Aircraft
, Aircraft Parts
, and the Fleet
objects. Today we’re going to look at how to tie all the objects together to turn our data into one big happy family. Creating relationships between your objects allows your users to easily understand how their data fits together. Having the aircraft as a single record that relates to Jobs
and Accounts
will mean that any update to the Aircraft
object will then reflect at both the account and job records without needing to update all the records.
By having an X Wing fighter as the aircraft and then joining it to multiple accounts, you can update the aircraft record once and move on to your next Jedi trick, knowing both your Job
and Account
will have the most up-to-date information. This also helps your users to easily see the data they want without needing to hunt and gather it from the system. We do this by adding a Lookup Relationship between our objects, tying them together, thereby making life more simple! Huzzah!
The actual creation of the relationships is pretty simple, but there are a few considerations that we will cover and then next episode we will work through how to display the related data on the pages we’ve been updating.
Currently, our data objects are sitting in our Skedulo tenant, all out on their own. The below section of the Entity Relationship Diagram (ERD) shows that only Jobs relate to an Account at the moment:
The line from the Account
to Job
has the three tines on the Job
side, indicating that a single Account
can have many Jobs associated with it. This makes sense, as you would hopefully keep servicing your customer’s aircraft over time, not as a one-off.
When adding a relationship between objects, one thing to remember is that you want to add the lookup field from the child object to the parent object. So in the scenario where we want to associate parts to an aircraft, you would go to the Aircraft Parts
object and add the lookup field there.
To add custom fields to your objects, we navigate to the Objects & fields
menu in the Settings
section of Skedulo, locate your Aircraft Parts object and then click on Add custom field
From the list of field types, simply select Lookup relationship
and click Next
Enter the field name, label and select the parent object you want to relate these records to and hit Save. Simple!
So now our ERD has aircraft with one or many parts associated with it:
This is great! However, what happens when you have a situation where you want many parents to relate to many children records? For example, you and your staff service lots of different types of aircraft, and your customers have lots of different aircraft as part of their fleet — you want an easy way of showing that information both on the Account
, and the Aircraft
records. This is where we have our ever fabulous Junction Objects! You can’t create a many-to-many relationship field directly within the platform, but you can put the lookups on your junction object!
Junction Objects
A junction object is there to tie together many objects. We want to be able to relate an aircraft to one or more Accounts
, and to one or more Jobs
. Similarly, an Account has more than one aircraft in their fleet, so you need to be able to add many aircraft to the fleet of the account. We do this by putting all the lookups on the junction object (in our case, the object called Fleet
). So following the above steps to create the lookup relationships, you would go to the Fleet
object and add a Lookup
to the Account
and a Lookup
to the Aircraft
!
Each Fleet
record now allows you to select an aircraft, an account, set whether the aircraft is still active within the fleet, and assign the serial number of that specific aircraft!
And your ERD is now looking almost like a big happy family:
The last thing you will want to relate is the Fleet
records to Jobs
. This will allow your Schedulers to identify which exact vehicle your wonderful servicing team needs to look at when out on the Job. No faffing around trying to figure out which aircraft is broken, or which parts you need to look at when you’re out on the job. Efficiency is our name and time saving is our game!
Join us here at Low Code Corner next time when we add some of this data onto our pages in a new tab! And as always, if you have questions, reach out to us via the comments below or on Twitter @SkeduloDevs