Journeys Through Search
Salesforce consulting

Syncing external notes to Salesforce: a case management sync pattern

Your case team writes notes in one system. Your sales team works in Salesforce. Without a sync, each side is missing half the story. This is the pattern we use to bring case notes into Salesforce on a schedule, without duplicates, in the right order.

Journeys Through Search · Updated · 2 min read

In short

  • Pull notes from the external API with scheduled Apex, by date changed since the last run.
  • Store the external note ID in a unique external ID field and upsert, so each note is stored once.
  • Keep the original note date in its own field and sort the feed on it.
  • If notes go both ways, stamp the date and time on each note you send back.

Why sync case management notes to Salesforce

A client calls the sales rep with a question about their case. The answer is in a note the case team wrote this morning, in another system. The rep has to log in somewhere else, or call a colleague.

When case notes sync into Salesforce, the rep sees them on the record. When Salesforce notes sync back, the case team sees what sales promised.

Where synced notes live in Salesforce

Short notes fit on a Task. Long notes do not: Task and Event cannot hold long text. For long case notes we use a custom activity object with a long text area, related to the lead, contact or opportunity.

  • Note body (long text), author and the original note date.
  • External note ID in a unique external ID field.
  • External case ID, so notes link to the right Salesforce record.
  • Direction: came from the case system, or sent from Salesforce.

The batch sync pattern, step by step

Authenticate with a named credential

Store the API endpoint and credentials in a named credential, not in code.

Schedule the batch

A Schedulable Apex class starts a Batchable job on a schedule that fits your team.

Pull changes since the last run

Ask the API for notes created or changed since the last successful run. Save that time when the job finishes.

Match each note to a record

Find the Salesforce record by the external case ID. Log notes that do not match, instead of dropping them.

Upsert on the external ID

Upsert the notes on the external note ID. An existing note is updated. A new one is created. No duplicates.

Log the run

Record the counts of notes created, updated and skipped, and any errors, so failures are easy to see.

Talk through your project

A free call about your integration, your CRM or whatever you are stuck on. Honest advice, even if you never hire us. No obligation.

Book a free call →

Keep the original dates and the right order

Every synced note gets a CreatedDate of the moment it reached Salesforce. That is the wrong date for the feed. Write the note date from the case system into its own field and sort on it.

We have fixed feeds that showed synced activities out of order, and historical imports that lost the original dates. The fix is the same: store the real date and use it everywhere.

Send Salesforce notes back to the case system

  • A trigger or flow sends a new Salesforce note to the case system API.
  • Add the date and time above each note, so the case team sees when it was written.
  • Mark notes that came from the case system, so they are not sent back again.
  • Map other fields the case team needs into the note, when their system has no field for them.

Bring over the history, then turn on the sync

For the first load, import historical notes with their original dates. Turn off triggers that should not fire on old data during the import, then turn them back on. Decide what stays in the external system: older documents can stay there and still be reached from Salesforce, which saves storage.

Show synced notes where reps look

Put the notes in an activity feed near the top of the record page, with the newest first and pinned notes on top.

Want help with this?

Book a free call about your CRM, integrations or reporting, or map your systems first with our free tech stack diagram builder.