Skip to main content

Salesforce deletions and merges

You can flag Planhat records whose equivalent Salesforce record was deleted or merged, and note which record it was merged into where applicable

Written by Alexander Käll

Summary

  • Marking deleted records: on each sync section in the Salesforce integration (when set to sync records from Salesforce to Planhat), you can configure it so Planhat records whose linked records are deleted in Salesforce are "flagged" via a custom checkbox field

  • Recording merged records: for the Salesforce objects Accounts, Contacts Leads and Cases, the sync section can also save which record a merged record was merged into, as an association or as the surviving record's Salesforce ID (via custom fields in Planhat)

  • Nothing is deleted in Planhat. Records are simply flagged/annotated, and then you decide what happens to them

  • Both settings are optional. A sync section with neither field set (for records deleted in Salesforce / merged in Salesforce) does not fetch deletions from Salesforce

Who is this article for?

  • Planhat admins who manage the Salesforce integration, in organizations where Salesforce admins delete and merge records as part of data hygiene (for example, RevOps or CS Ops)

Series

We have a series of articles on the Salesforce integration, starting with the main overview guide here.


Article contents


Introduction

When Salesforce is the "system of record", its admins may delete duplicates and merge records in Salesforce, to keep the data clean. When syncing data between Salesforce and Planhat, a regular sync only reads records (e.g. Accounts and Contacts - see "Definitions" box below) that exist in Salesforce, so a deleted or merged-away record that had previously synced to Planhat would stay in Planhat with no sign that it is gone from Salesforce, and someone would need to manually remove/adjust it in Planhat if desired.

In late 2026, we released support for deletions and merges in the Planhat Salesforce integration. During each sync, Planhat asks Salesforce which records were deleted or merged since the last sync, and marks the matching Planhat records. Planhat never deletes a record because it was deleted in Salesforce - deleting a Company would also delete its End Users, Conversations and other associated data, and a record deleted in Salesforce by mistake can be restored there. Instead, the "flag" within Planhat lets you filter, report on, and act on these records - for example, with an Automation.

📚 Further reading

For a general overview of setting up the Planhat Salesforce integration, see here. For syncing custom models, see here.

📌 Definitions

  • An "object" in Salesforce is the metadata container - e.g. "Account" or "Contact"

  • The Planhat equivalent is "data model" or simply "model" - e.g. "Company" or "End User"

  • A "record" in Salesforce/Planhat is the data inside the object/model - e.g. within the Account object, records could be "Apple", "Microsoft" and "Google"

📌 Important to note

"Sync sections" in the Salesforce integration are not to be confused with "Sections" in the context of Planhat content (where a Section is an organized group of Pages).


What is deletion/merge support in the Salesforce integration?

When you (as a Planhat admin) are configuring the Salesforce integration in Planhat, to sync records between Salesforce and Planhat, you can optionally configure up to two of the following settings per sync section (model/object pair), as shown in the example screenshot below:

  • "Mark deleted [model records] in [your choice of eligible custom field]"

  • "Save merged-into [model record] in [your choice of eligible custom field]"

Click the image to view it enlarged

Once set up, when records previously synced to Planhat are then deleted or merged in Salesforce, this deletion/merge information is also synced into Planhat, and the relevant Planhat records are labelled accordingly, allowing you to take action in Planhat as desired.

In the rest of this article, we will go through this process and how to set it up.


What happens when data is synced from Salesforce to Planhat

Let's take a closer look at the results of configuring the record delete/merge functionality in the Salesforce integration in Planhat.

General information on record deletion/merge syncing

Records in Salesforce/Planhat are matched the same way the sync section matches them for a "normal" sync (for example, by the Salesforce ID reference on Companies, or by the keyable on a custom sync section).

Archived records are included.

Only records that already exist in Planhat are affected by this functionality. For example, this applies when a record has been synced to Planhat from Salesforce and then is deleted in Salesforce, but does not apply if a record is deleted in Salesforce before it ever synced to Planhat.

A Contact deleted together with its Account is flagged too.

Deleted records

If a record is deleted in Salesforce, the checkbox field specified in the integration (we discuss the setup here) is set to "true" on the equivalent Planhat record, so it's flagged in Planhat as having been deleted in Salesforce. Nothing else on the record changes.

Merged records

In Salesforce, merging keeps one record (the "surviving" record) and deletes the others.

For each deleted record that was merged, when this is synced from Salesforce to Planhat:

  • The "mark deleted" checkbox field specified in the integration is set to "true" on the equivalent Planhat record, the same as happens with other deletions (as we just described above)

  • The "merged-into" field specified in the integration is filled on the "deleted" record equivalent in Planhat

    • If it's an association field type: it's associated with the "surviving" Planhat record equivalent. If the "surviving" record equivalent is not in Planhat, the field is left empty

    • If it's a text field type: the "surviving" record's Salesforce ID is populated here

The Planhat record mapped to the "surviving" Salesforce record is not changed.

Example

(Remembering that Salesforce Accounts are synced with Planhat Companies)

Let's say Account B (the "deleted" record) is merged into Account A (the "surviving" record) in Salesforce. On the next sync from Salesforce to Planhat:

Planhat record

Field selected for "mark deleted"

Field selected for "merged-into"

Company B ("deleted")

Set to "true"

Populated with an association to Company A (if it's an association field), or Account A's Salesforce ID (if it's a text field)

Company A ("surviving")

Unchanged

Unchanged

📌 Important to note

Salesforce can merge Cases without actually deleting the merged Case. In this scenario, Planhat still sets the "mark deleted" checkbox to "true" on the equivalent Planhat ticket (Conversation) and populates the "merged-into" field, so a merged Case is treated the same way as a merged Account or Contact etc.

Restored records

If a record is restored from the Salesforce Recycle Bin, i.e. it's no longer deleted in Salesforce, the next sync from Salesforce to Planhat sets the Planhat "mark deleted" checkbox field back to "false" and clears the "merged-into" field (where used) - i.e. this "undo" in Salesforce is also synced to Planhat.

A value you change by hand in Planhat stays until the record changes in Salesforce again.


Results from different types of syncs

  • Scheduled automatic sync. After each sync section's records are fetched from Salesforce, Planhat reads the deletions/merges since the last successful sync. (Cases use the Case sync section's own sync window)

  • Manually fetching one sync section. Fetching a sync section manually via its header in the integration also fetches that sync section's deletions/merges, so you do not need to wait for the next scheduled sync

  • "Fetch all". Reads every deleted and merged record still in the Salesforce Recycle Bin, so you can use it to flag records deleted before you set up the fields in the integration

  • Fetching for one Company. A fetch started from a Company Profile does not fetch deletions


Limitations

  • Recycle Bin window

    • Salesforce keeps deleted records in its Recycle Bin for up to 15 days, and can empty it sooner

    • Records hard-deleted, emptied from the Recycle Bin, or deleted while the integration was not syncing for longer than that, are not flagged

    • If the integration has not synced for more than 15 days, the Logs tab shows a warning naming the date it last synced

  • Existing records only

    • A deleted record in Salesforce that was never synced to Planhat is ignored

    • In this deletion/merge feature, Planhat only writes to the selected two fields on records already in Planhat. Planhat never deletes, archives or creates records because of this feature

  • If the "surviving" record is not in Planhat ...

    • An association-type "merged-into" field stays empty when the surviving record is not in Planhat - for example, because it is outside the fetching filter

    • Use a text field if you need the ID in every case

    • We discussed this above here

  • If the selected field is later removed ...


Which Salesforce integration sync sections are compatible with deleted/merged records functionality

Sync section

"Mark deleted"

"Save merged-into"

Company ⇄ Account

Yes

Yes

End User ⇄ Contact

Yes

Yes

Ticket ⇄ Case

Yes

Yes

Task, Note, Product, Deal, Line Item

Yes

No

Asset, Project

Yes

Only if the sync section's Salesforce object is Account,

Contact, Lead or Case

Custom sync sections

Yes

Only if the Salesforce object is Account, Contact, Lead or Case

The settings are available only on sync sections that fetch from Salesforce to sync to Planhat ("Receive from Salesforce" or "Both Directions"); a sync section that only sends to Salesforce does not show them.

Sync sections that sync the Salesforce User object do not show them, because Salesforce does not report deleted Users.

On a sync section whose Salesforce object cannot be merged (e.g. Task), only the "Mark deleted" checkbox setting is shown:

Click the image to view it enlarged


How to configure the deleted/merged records functionality in the Salesforce integration

Preliminary step: creating the custom fields in Planhat to receive the data

Before you can configure these settings in the Planhat Salesforce integration, you need to create the fields in Planhat that you will select.

For each Planhat model you want to receive the deletion/merge information from Salesforce, you will create a custom field for the deletion, and a custom field for the merge details (if applicable).

For example, for the sync section between the Planhat Company model and the Salesforce Account object, if you want to sync deletions and merges from Salesforce to Planhat, you'll need to create two custom fields on the Planhat Company model.

Planhat field specifications:

Purpose

Field type

Suggested name

To mark the Planhat record as deleted in Salesforce

Checkbox

"Deleted in Salesforce"

To note in Planhat what the record was merged into in Salesforce (Accounts, Contacts, Leads and Cases only)

Association to the same model, or text*

"Merged into"

*Choose the "merged-into" field type by what you need:

  • Association field - for example, a Company association on Company:

    • The deleted Company record is associated with the Company record it was merged into, so you can open the surviving record directly (and so on for other models)

    • The surviving record must already be in Planhat

  • Text field:

    • Holds the surviving record's Salesforce ID

    • It is filled even when the surviving record is not in Planhat

🚀 Tip

See here for more on the surviving record etc.

Configuring deletion/merge support in a sync section

  1. Navigate to the Salesforce integration

    • In Planhat OS, you can find integrations within the "Settings" Tool

    • In pre-OS Planhat, integrations are located in the App Center

  2. In the "Configuration" tab, expand the sync section you want to configure, for example Company ⇄ Account

  3. In the Planhat card on the left, below "Send null values to Salesforce", find the two settings:

    • "Mark deleted [model records] in": pick the checkbox field (as we discussed above)

    • "Save merged-into [model record] in": pick the association or text field (as we discussed above)

      • This setting is only present on sync sections whose Salesforce object can be merged - see here for further information

  4. Click "Save section"

Click the image to view it enlarged

Each of these two settings has an info tooltip that summarizes its behavior:

Both settings are optional and independent. For example, you could set only the "mark deleted" checkbox, while leaving the "merged-into" setting empty (unset), as shown in the example screenshot below.

🚀 Tip

  • The labels use your model names. If you have renamed a model in Planhat, the labels show your name for it

  • The Ticket ⇄ Case sync section labels its settings with "Ticket" ("Mark deleted Tickets in" and "Save merged-into Ticket in") rather than the actual Planhat model of Conversation (ticket being a type of Conversation)

📌 Important to note

When you save the integration configuration, Planhat checks the selected fields. The save is rejected with a message naming the sync section if there is an issue, e.g. if the selected "mark deleted" field is not a checkbox, or if the "merged-into" field is not a text field or an association to the sync section's own model.


Next steps: working with flagged records in Planhat

As we have described in this article, although you can set up the integration so that information about Salesforce deletions and merges is synced into Planhat, it does not actually delete or merge those records in Planhat. Instead, having that information in Planhat enables you to choose to take your own choice of action. For example:

  • Filter deleted records out of views and reports (e.g. Dashboards): add "Deleted in Salesforce is false" (or the equivalent corresponding to your field name) to the filters your teams use

  • Act on it with a Custom Automation: trigger on the "mark deleted" (e.g. "Deleted in Salesforce") checkbox changing to "true", and have actions such as archiving the record, reassigning its open Tasks, or notifying the record Owner

  • Stop sending record updates to Salesforce: Planhat still sends changes made to a "deleted"-flagged record to Salesforce, and Salesforce rejects them with an ENTITY_IS_DELETED error in the Logs tab. Add "Deleted in Salesforce is false" (or the equivalent corresponding to your field name) to the sync section's Sending filter to stop these

Did this answer your question?