Sub topic 4
Linking Activities to the Right Records
Assume you know the basics of contacts, companies, deals, and sales stages. You should also be comfortable navigating a CRM and reading simple JSON. This chapter focuses on associations, which are the links that connect an activity to the records it describes.
Why associations matter
An activity is a record of work or communication. Examples include a call, email, meeting, note, or task. The activity becomes useful for forecasting and handoffs only when it is linked to the correct records.
A typical sales interaction involves several records:
- A contact is an individual person.
- A company is the organization connected to that person.
- A deal is a revenue opportunity.
- An activity records what happened and what should happen next.
For example, a discovery call might involve Dana Lee, who works at Acme, and the Acme annual-license deal. The call should usually be associated with Dana, Acme, and the deal. A manager reviewing the deal can then see the conversation, while a rep viewing Dana's record can see the same history.
Salesforce links: WhoId and WhatId
Salesforce activities use two important relationship fields:
WhoIdidentifies the person involved. It usually points to a Contact or Lead.WhatIdidentifies the business record involved. It can point to an Account, Opportunity, Case, or another supported object.
For a call with a known contact about an opportunity, use the contact in WhoId and the opportunity in WhatId.
Task t = new Task(
Subject = 'Discovery call with Dana Lee',
Type = 'Call',
Status = 'Completed',
ActivityDate = Date.today(),
Description = 'Confirmed budget owner. Next step: send pricing by Friday.',
WhatId = opportunityId,
WhoId = contactId
);
insert t;A common mistake is to put the account in WhoId. An account is a company, not a person, so it belongs in WhatId. Another mistake is leaving WhatId empty. The activity may still appear on the contact's timeline, but it will not appear as part of the opportunity's history.
Salesforce supports different activity relationships depending on the object and activity type. Check the object's supported relationships before building an integration.
HubSpot associations
HubSpot uses associations rather than Salesforce's WhoId and WhatId fields. A note, call, meeting, or task is created as an activity object. You then associate it with other CRM objects by ID.
The association must identify both:
- The target record, such as a deal or contact
- The association type, which tells HubSpot how the records are related
For example, a note associated with a deal can use the deal's ID and the correct note-to-deal association type.
body = {
"properties": {
"hs_timestamp": "2026-11-27T15:00:00Z",
"hs_note_body": "Demo went well. Next step: security review on Dec 4."
},
"associations": [
{
"to": {"id": deal_id},
"types": [
{
"associationCategory": "HUBSPOT_DEFINED",
"associationTypeId": 214
}
]
}
]
}Association type IDs can differ by object pair and API version. Do not guess them. Confirm the required type in the HubSpot developer documentation or your account's schema.
Choosing the records to link
Use the narrowest accurate set of associations:
| Situation | Link the activity to |
|---|---|
| Qualification call with one buyer | Contact, company, and deal |
| Internal pricing review | Deal, and possibly an internal task owner |
| General company relationship note | Company, and a contact if one is named |
| Follow-up reminder | Deal and the person responsible for the next step |
Avoid linking an activity to every possible record. Over-association makes timelines noisy and can make reports count the same work multiple times.
Common errors and checks
Check these conditions before saving or creating an activity:
- The contact belongs to the expected company.
- The deal belongs to the expected company.
- The activity uses the correct record IDs, not names copied from a screen.
- The association type matches the activity and target object.
- The activity is visible from the deal timeline after creation.
- The note explains which customer conversation the activity represents.
If an activity appears on a contact but not on a deal, inspect the deal association first. If it appears on the wrong company, verify the contact and deal IDs rather than changing the activity text.
Exercise
A completed call appears on the correct contact but not on the opportunity. In Salesforce, which relationship should you inspect first?
Show answer
Inspect the activity's WhatId. It should contain the opportunity ID. The contact belongs in WhoId.