In our previous blog post, we reviewed what a customer relationship management (CRM) system is and put together the requirements for a basic CRM. Yet, we’re not quite ready to start writing code. Next, we need to draw up an entity relationship diagram - ERD for short. In database land, this is a map of all the buckets of information that we will track and the connected data among them. As part of this process, we will look for places to normalize the data. Normalizing means we will look for instances where we can avoid entering the same data in two different areas.
Let’s start with our main three modules: Contacts, Companies, and Interactions.
The temptation here would be to include a phone number field in both the Contacts module AND the Company module. But it's less than ideal to store the same data in two places within a database. For one, we duplicate the effort of creating and maintaining the fields. Secondly, validating the data and running reports is easier when we store the data within the same table. And finally, a single table provides an efficient way to collect multiple company and contact phone numbers of various types, including local office lines, toll-free numbers, mobile, etc. So, the ERD looks something like this:
Let's start by creating a brand new FileMaker file, and we can save it to our local machine. We'll call it “CRM_Example.” Next, we go into Manage Database to start adding the tables. Note that FileMaker automatically creates one default table with the same name as the file we created. We deleted that table, but we could rename and use it. Then we add a table for every entity on our ERD. Without going into each table yet, the list looks like this:
We refer back to our initial brainstorming about what we need the CRM to do for this. For a real-life project, we would have multiple conversations with key stakeholders for whom we were building this to determine the required fields.
We rename the “Primary Key” field to “ID” to keep things as simple as possible. We also create foreign key fields in the appropriate tables to specify the relationships between the tables.
Finally, we navigate to the Relationship tab of the Manage Database dialog and recreate our ERD using the new tables we've created. So as not to generate a duplicate path to the same Table Occurrence, we’ll have to make a Table Occurrence Group for both contacts and companies. When we're done, it will look something like this:
Sign up for our newsletter to keep up with the latest custom app development news and trends.
This article is also published on FileMakerProGurus.com.