As much as I love Notion, there are some features that anybody with database experience will recognize are sorely missing, especially in regards to referential integrity. Chiefly, that although templates and filters will let you show related data from inside of a database row, there’s no (easy) way to enforce multiple relationships with your data for referential integrity.
So, if you’re making a note for a project, and the project is for a client, you can only enforce the first level relationship from the note to the project. Yes, you can manually edit filters on every project or note, but that defeats the point of having relationships enforced automatically to help with referential integrity.
If you extend the relationships, adding tasks for the note, the missing links get worse, even though there’s a clear business relationship that the tasks would be relevant for both the project, and the company.
Using Make.com to Enforce Notion Business Rules For Referential Integrity
The following goes into detail for enforcing one set of missing relationships for referential integrity, from the Notes perspective. There is another analogous scenario managing the same from the Tasks perspective.
- The process kicks off from a WebHook, using the process described in How to Fire WebHooks from Notion, though you could just as easily skip this and poll on step 2.
- We’re doing a search for all notes that satisfy the filter “Has X, but not Y” where X is the immediate parent relationship, and Y is the grandparent. For example, a note has a project link, but not a client/company link. We’re going to check for all such cases (using OR), and then respond to the particular case we’re dealing with after the router.
- We make sure we have at least one bundle of data to work with.
- The filter checks for the bundles where the note came from a task, but the task lacks a company record.
- We open up the task (parent) that the note came from.
The filter then confirms that the parent task has a company record. - We update the original note to put the company ID into the note that was missing it.
- We open up the task (parent) that the note came from.
- The filter checks for bundles where the note has a Project, but no company.
- We open up the Project (parent) that the note came from.
The filter then confirms that the parent project has a company record. - We update the original note to put the company ID into the note that was missing it.
- We open up the Project (parent) that the note came from.
- We check that we just finished the very last bundle from the notes from step 2.
- Now that we know we are finished, we can return a result to the WebHook response.