"Patient ka number badal gaya. Ab kitni jagah update karein?"
"The patient's number changed. How many places do we update now?" If the answer is more than one, the model is wrong.
- Which App?
- Which sObjects?
- Which fields?
- Why relationships?
- Which type?
Step 2: Design the Model
In Step 1 you listened to the client. Now you turn those requirements into a structure Salesforce can hold: the App, its sObjects, their fields and the relationships that keep each fact in one place.
You are hereSteps 1-4 Requirements and configurationSteps 5-9 DevelopmentSteps 10-11 Test and deploySteps 12-15 Rollout
Hook: one number, four copies
A patient's mobile number was typed into four places in the hospital's system. Today she gave reception a new number. Try updating it both ways.
Without relationships
The number is stored 4 times.
With relationships
The number is stored once, on Patient. The other records point to it.
Midway through the left side, the system holds two different numbers for one patient. Which is right? The reminder goes to the old number and the patient misses her visit. Nothing crashed, and the data simply stopped being trustworthy.
By the end of this workbook, you will be able to
- Identify the App from the client's business or service.
- Identify sObjects from the key pillars of that business.
- Derive fields from transactions using our four-step method.
- Explain how redundancy leads to inconsistency, and spot it in a draft model.
- Choose between Self, Lookup, Master-Detail, Many-to-Many and Hierarchical relationships, and defend your choice.
- Summarise child records with Roll-Up Summary fields.
- Build, test and show your model in Salesforce with Schema Builder.
Your org from Step 1 becomes Org A, for Projects 1 and 2. Sign up for a second free Developer Edition org at developer.salesforce.com, using a different username. This becomes Org B, for Project 3.
Why two? Project 3 needs a setting that can't be turned off, and in Step 6 you will connect the two orgs through real integration.
Concept: five questions, in this order
Our method answers these one by one. Each answer sets up the next question.
Question 1: How do we identify the App?
Look at the business of the client, or the service being delivered. Ask: what would the client's staff call this system?
| Basis | Example App | Tabs people open |
|---|---|---|
| Client's business | HIMS for a hospital | Patients, Doctors, Appointments, Lab Orders, Bills |
| Client's business | Training Management for an academy | Courses, Batches, Students, Enrolments, Attendance |
| A service | Payment Integration, a console for support staff | Payment Requests, Integration Logs |
In Salesforce, an App is a labelled collection of tabs, so it organises the work without owning the data. One sObject can appear in several Apps. The data itself lives in sObjects.
- Common mistake: Naming the App after the technology, like "Salesforce App". Name it in the client's language.
- Common mistake: Creating one App per sObject. Tabs belong together when the same people use them for the same work.
- How many Apps? Start with one for each distinct business or service. Add another when a different group of people does clearly different work.
Try it: what is the basis for this App?
Question 2: How do we identify sObjects?
Find the key pillars of the business, meaning the entities it can't run without. Return to the nouns in your Step 1 register, then test each one:
- Does the business keep many of these, each with its own details?
- Does it have a life of its own, with records created, changed and reported on?
- Does someone in the business actually use this word?
Three yeses make a likely sObject. For example, "Patient" passes. "Patient mobile" is a detail about a patient, so it becomes a field. Before creating a custom object, also check whether a standard sObject already does the job, such as Account, Contact or Opportunity.
- Common mistake: Creating "Paid Bills" and "Unpaid Bills" as two sObjects. That is one sObject, Bill, with a Status field.
- Common mistake: Making the client's company an sObject when there is only one of it. It fails the first test, because the business doesn't keep many of these.
- Keep an open mind: Your list is a first draft. The four-step field method often reveals sObjects you missed, as you will see with Enrolment.
Try it: listen for the pillars
Classify each word from this client's sentence.
Question 3: How do we identify fields?
Beginners list fields from imagination. We derive them from what the business does.
- Identify all transactions in the business.
- To perform a transaction, we need data.
- Data is captured through fields.
- Map each field as a property of an sObject.
| 1. Transaction | 2. Data needed | 3. Fields | 4. Property of |
|---|---|---|---|
| Book an appointment | Who, with whom, when, why | Patient Name, Patient Mobile, Doctor Name, Date and Time, Reason | Appointment |
Choose the right type for each field, because the type decides what can be entered and calculated.
| Data looks like | Field type | Example |
|---|---|---|
| Short words | Text | Certificate Number |
| Quantity or rupees | Number, Currency, Percent | Capacity, Fee, Discount |
| Calendar values | Date, Date/Time | Start Date, Appointment Time |
| One choice from a list | Picklist | Batch Type, Status |
| Yes or no | Checkbox | Parent Consent |
| Contact details | Phone, Email | Mobile, Student Email |
| Calculated from other fields | Formula | Age, Balance Due |
| Generated running number | Auto Number | BATCH-0001 |
Salesforce gives each sObject standard fields such as Id, Name and Created By. Custom API names end in __c, for example Patient__c.
Question 4: When do we need relationships?
Once the mapping is done, look at what you built. It has a drawback:
Keep the field on the one sObject it truly describes. Every other sObject gets a relationship to that record. To display the value without storing it again, a cross-object formula can read it through the relationship.
Question 5: What are the types of relationships?
| Type | In one line | Our example |
|---|---|---|
| Self | A record points to another record of the same sObject. It must be a lookup. | Course to its Prerequisite Course |
| Lookup | A loose link. By default, delete on cascade doesn't apply. | Batch to Trainer |
| Master-Detail | A tight parent-child link. Delete on cascade applies. Many children link to one parent record. | Patient as Detail of Doctor (below) |
| Roll-Up Summary | A field on the parent that uses child records: record count, min, max or sum. | Doctor's Patient Count |
| Many-to-Many | 3 sObjects: 2 masters and 1 common child, called the junction object. | Doctor and Test, through Patient |
| Hierarchical | A special lookup on the User sObject only, from one user to another. | Receptionist to Manager |
Roll-Up Summary is a field type rather than a link, but it belongs here because it needs a Master-Detail relationship to work.
See what delete on cascade means
Doctor Anjali has three Patient records under her. Choose a relationship, then delete her record.
Choose a type, then delete the record.
Lookup or Master-Detail: compare
| Question | Lookup | Master-Detail |
|---|---|---|
| Must a child have a parent? | Optional by default, can be made required | Always required |
| Parent deleted? | Clears the field by default, or can block the deletion. Cascade needs Salesforce Support to enable it. | Children are deleted too. Restoring the parent from the Recycle Bin restores them. |
| Owner and sharing | The child has its own | The child has no Owner field and inherits from the parent |
| Roll-Up Summary on the parent? | Not available for custom lookups. Use Flow or Apex. | Available: count, sum, min, max |
| Move child to another parent? | Generally allowed | Blocked unless "Allow reparenting" is on |
| How many per object? | Up to 40 relationship fields in total, of which at most 2 can be Master-Detail | |
The rules that catch people
- Create Master-Detail before loading data. It can't be added to an object that already has records. Create a lookup, fill it on every record, and then convert it.
- A standard sObject can't be the Detail of a custom object. Lead, User, Product and Price Book can't be the Master.
- A junction object can't have Detail children. It has used both Master-Detail slots, and Salesforce doesn't let it be a master. Use a lookup for anything hanging off it.
- Chains are limited. You can have up to 3 custom detail levels, and an object can appear only once in a chain.
- The first Master-Detail on a junction is primary. It controls the junction's owner and look, so create the more important parent first.
- Deleting either master deletes the junction record. The other master isn't affected.
Choose the relationship
Answer these for any two sObjects in your projects.
Demo: Project 1, Training Management System
Watch the full method on Akshara Skills Academy, our fictional client from Step 1.
Identify the App and sObjects
App: Training Management, because that is the academy's business.
Here is how the three tests sort the words from the Step 1 conversation.
Key pillars so far: Branch, Course, Trainer, Batch, Student, Session. We will discover more as we go.
The four steps: first draft
This draft came from the transactions in your Step 1 register. Red fields appear in more than one transaction.
Find the drawback
Student Name and Batch Code are each stored several times. If a student corrects the spelling of her name, her certificate and her fee record could disagree. So each repeated field goes back to its true home.
| Repeated fields, and those that travel with them | True home | What the other sObjects use instead |
|---|---|---|
| Student Name, Mobile, Email, Date of Birth | Student | A relationship to Student |
| Batch Code | Batch | A relationship to Batch |
| Course Name, Course Fee | Course | Batch links to Course |
| Trainer Name, Trainer Mobile | Trainer | Batch and Session link to Trainer |
Now we ask how Student and Batch connect. One student joins many batches, and one batch has many students, so this is many-to-many. Enrolment becomes the common child. It also holds what belongs to the link itself, like Enrolment Date and Discount.
The final model
Master-DetailLookup or SelfJunction object
Relationships, with reasons
Roll-Up Summary fields
Seats Filled gives Step 3 what it needs to block the 31st enrolment (TMS-03).
Build it in Org A
- Create the App. Go to Setup > App Manager > New Lightning App and name it Training Management.
- Create parents first. Go to Setup > Object Manager > Create > Custom Object. Create Branch, Course, Trainer, Batch and Student. Tick "Launch New Custom Tab Wizard" and "Allow Reports". Use Auto Number for Batch Code.
- Add fields. Open each object and go to Fields & Relationships > New. Follow the table above.
- Create the children. Create Enrolment, then its Master-Detail to Student first, then to Batch. Continue with Session, Attendance, Fee Instalment, Assessment Result and Certificate.
- Add Self and Lookups. Add Prerequisite Course on Course and the other lookups from the table. For each one, choose its delete behaviour on purpose.
- Add Roll-Ups. On Batch, go to Fields & Relationships > New > Roll-Up Summary. Do the same for the others.
- Check the picture. Open Setup > Schema Builder, select your objects and compare with the diagram. Schema Builder can also create objects and fields by dragging.
- Add tabs to the App. Return to App Manager and add a tab for each main sObject.
- Prove it works. Create 2 batches and 3 students, then enrol one student in both batches. Delete a test batch and watch its Enrolments and Sessions go to the Recycle Bin. Restore it and see them return. Then add a Fee Instalment linked to an Enrolment and try deleting that batch again. Write down what happens, and why.
Practice: Project 2, Hospital Management System
We do this in two stages. First learn each relationship with our classic Doctor, Patient and Test lab. Then design for the real hospital.
Stage 1: The relationship lab
Master-DetailJunction object
| Build this | What it teaches |
|---|---|
| Patient as Detail of Doctor | Child links to Parent record. Many Patients to 1 Doctor. Delete the Doctor, and the Patients go too. |
| Roll-Up on Doctor | Doctor summarises Patients: record count, and min, max and sum of a Fee field. |
| Patient as Detail of Test too | 1 Doctor to N Tests, and N Doctors to 1 Test. Doctor and Test are now many-to-many: 3 sObjects, 2 masters, 1 common child, with Patient as the junction. |
- In Org A, create Lab Doctor, Lab Test and Lab Patient, so that they don't clash with your real project.
- On Lab Patient, create a Master-Detail to Lab Doctor, then to Lab Test. Add a Currency field called Fee.
- On Lab Doctor, add 4 Roll-Ups: Patient Count, Lowest Fee, Highest Fee, Total Fees. Do the same on Lab Test.
- Create 2 doctors, 2 tests and 4 patients. Check that the Roll-Ups are correct.
- Try to create a new Detail object under Lab Patient. Salesforce blocks it because Lab Patient is a junction. Write down what you see.
- Delete a doctor. Check the Recycle Bin, then restore the doctor.
Stage 2: Now ask the client's question
The lab teaches the mechanics perfectly. But imagine Dr. Meena, our hospital administrator, sees it and says: "A doctor retires and we delete that record. Do all those patients' records disappear? And what about a patient who sees three doctors?"
That is your cue. In a real hospital, a Patient exists independently of any Doctor. So the real many-to-many link is the visit, and that becomes the Appointment sObject.
- App: Name the App and say why.
- sObjects: Using HMS-01 to HMS-14 from Step 1, list the key pillars.
- Four steps: Take these transactions: register a patient, book an appointment, order a test, record a result, write a prescription, raise a bill, approve a waiver. Fill in the Project 2 tab of your Model Pack.
- Fix it: Mark every repeated field, then move it to its true home.
- Relate: Choose each relationship and write down why.
Exercise 1: Where does this field live?
Exercise 2: Which relationship?
Exercise 3: Compare with the model answer
Open the Project 2 model answer after you finish
App: HIMS, because hospital management is the client's business.
Master-DetailLookup or SelfJunction object
Open design points for later steps:
- Deleting a Doctor: Master-Detail would remove appointment history. So Doctors are never deleted, only marked inactive with the Active checkbox. Step 12 removes the delete permission.
- 30 outpatients a day (HMS-04): A plain Roll-Up counts all appointments, not one day's. Step 3 revisits this, and it may need Step 9.
- Privacy: Note which fields are sensitive, like Diagnosis, so that Step 12 can restrict them (HMS-11).
Now build your model in Org A, following the same order as the Demo: App, parents, children, Self and Lookups, Roll-Ups, Schema Builder, tabs, proof.
Project: Project 3, CRM for Training Management
Do this one yourself. The rule from Step 1 stands: use built-in standard sObjects. So the question changes from "What should I create?" to "What already exists?"
Same four steps, one new check
Do the four steps as usual. Before creating any field, check in this order:
- Does a standard field already hold this? For example, Stage on Opportunity.
- Does a standard relationship already connect these? For example, Contact to Account.
- If not, add a custom field to the standard sObject.
- A custom object needs a written reason why nothing standard fits.
The relationships Salesforce already gives you
The same five ideas appear throughout the standard model. Find each one in Org B.
Built-in standard linkSelf or hierarchyWorks like a junction
Open Setup > Schema Builder in Org B and tick these sObjects to compare. Case's and Order's links to Account are left out of the diagram to keep it readable.
The decision we saved from Step 1: Person Accounts
Students are individuals, but colleges and companies are organisations. The academy deals with both.
| Option | Works well for | Trade-off |
|---|---|---|
| Person Accounts + Business Accounts | Businesses that sell to both individuals and organisations | Can't be turned off once enabled, and adds setup considerations |
| Business Accounts + Contacts only | Selling mainly to organisations | Individual students need an artificial company to sit under |
Our decision for Project 3: Enable Person Accounts in Org B only. That is why this project has its own org. After enabling, a Lead with a blank Company converts to a Person Account in Lightning Experience, and a Lead with a Company converts to a Business Account.
- In Org B, create at least one Business Account record type.
- Set the organisation-wide default for Contacts to Controlled by Parent, in Setup > Sharing Settings.
- Go to Setup > Person Accounts, review the org impacts and enable it. If the setting isn't offered in your org, tell your trainer.
Exercise: What do you need to add?
- App: Create a Lightning App called Admissions, with tabs for the standard sObjects your counsellors use.
- Four steps: Use CRM-01 to CRM-13 from Step 1. Fill in the Project 3 tab of your Model Pack.
- Standard first: For each field, record whether it is standard or custom.
- Configure: Add the custom fields and set Opportunity Stage values to Demo Booked, Demo Attended, Fee Discussed, Admitted, Lost.
- Prove it: Create a Lead with no Company, and convert it. Create a College Account, a Contact, an Opportunity with a course, and check its Amount.
Open the Project 3 model answer after you finish
App: Admissions, because this is the service the sales team runs. Custom objects: none are needed for this release.
Duplicates we avoided: The course fee stays on Price Book Entry. The student's name and mobile stay on the Person Account. Opportunity Amount is calculated from Opportunity Products instead of being typed in.
How does this reach Project 1? Student exists in both orgs on purpose, as two separate systems. Step 6 connects them so that an Admitted Opportunity creates the Student and Enrolment (CRM-12). External ID fields are how the two systems will match records.
Build your Model Pack
Your work saves in this browser on this device. Use "Download my work" regularly so that you keep a copy.
Build with AI
Do it by hand first, so that you can catch the AI's mistakes. Then use AI to find what you missed and to speed up the build.
Building with Agentforce Vibes or Claude Code
Developer Edition orgs include Agentforce Vibes, and tools like Claude Code can connect through the Salesforce DX MCP Server. Use the last prompt above to generate your model as metadata files. Deploy only to your own practice org, then compare the result with your design in Schema Builder.
For this workbook, click-building comes first. You will use the developer tools more fully from Step 5.
Reflect and exit check
Quick test
Exit check: are you ready for Step 3?
Interview preparation
Practise saying these answers aloud. Then take them into your text and voice interview practice with our AI agents, and work on the feedback you get.
For your resume and portfolio
Describe this honestly as training project work:
- Add Schema Builder screenshots of your three models to your portfolio, using invented data only.
- Be ready to explain one decision you changed, and why. This impresses interviewers more than a perfect diagram.
Trainer notes
Open the suggested session plan and coaching notes
| Session | Cover | Students leave with |
|---|---|---|
| 1 (90 min) | Hook. Questions 1 to 4, including the App and sObject exercises. Do the four steps live on two Hospital transactions. | Project 1 draft reviewed and the drawback understood. |
| 2 (90 min) | Question 5. Delete simulator. Build the Doctor, Patient, Test lab live. | Lab built, and Project 1 build as homework. |
| 3 (90 min) | Review Project 1 in Schema Builder. Play Dr. Meena and run Stage 2 as a debate. | Project 2 pack and build as homework. |
| 4 (90 min) | Tour the standard model in Org B. Decide Person Accounts together. Start the CRM. | Project 3, reflection and exit check. |
Common mistakes to catch
- One sObject per status, such as Paid Bills and Unpaid Bills. Ask: "Is this a different thing, or the same thing in a different state?"
- Fields listed without a transaction. Ask: "Which transaction needs this?"
- Every link is Master-Detail. Ask: "If the parent is deleted, should this record really go too?"
- Creating a Detail under a junction. Let them try, and let Salesforce say no.
- Adding data, then failing to add Master-Detail. Show the lookup-then-convert route.
- Typing a Doctor Name field on Appointment. Ask: "What happens when her name is corrected?"
- Treating Doctor-Patient-Test as the final hospital design. It teaches the mechanics; Stage 2 designs for the client.
Accept reasoned alternatives
Models can differ. Enrolment could use Master-Detail to Batch and a lookup to Student, so that it can have Detail children, at the cost of the Student Roll-Up and not being a pure junction. Accept any design that keeps each fact in one place, works in the org and comes with a reason.
Check before each batch
Salesforce changes with every release. Confirm the Person Accounts setup path and App Manager steps in a fresh Developer Edition org.
Sign-off standard
A model passes when each field traces to a transaction, no fact is typed in two places, each relationship has a reason and a chosen delete behaviour, and the proof steps were done in the org.