Migrating completed form responses

When you need this

A completed response is an audit record of a submission. Clients migrate them when moving orgs, consolidating instances, or restoring after data loss. Unlike a live form, a response is worthless if it cannot be replayed: the whole point of keeping it is that a reviewer can later open it in the preview app and see exactly what was submitted, against exactly the form version it was submitted on.

That last point is the trap. Read Migrating forms between orgs first. This article assumes the forms and their full version history are already in the target org.

Why responses are harder than forms

A FormResponse__c carries Data_Version_ID__c. This is not a form record Id. It is the Id of a specific ContentVersion, the exact saved version of the form's Template.3bt file that the submitter saw. The preview app reads this field, loads that ContentVersion, downloads its definition, and fills it with the response's stored answers. See How previews work and version control.

ContentVersion Ids are org specific. When you migrate the definition Files, the target org assigns brand new ContentVersion Ids. So a response copied verbatim points its Data_Version_ID__c at a version Id that does not exist in the target org. The record loads, the numbers look right, and then preview fails or shows the wrong version. This is the single thing to get right.

You must translate every response's Data_Version_ID__c from the source ContentVersion Id to the matching new ContentVersion Id, using the version map you saved during form migration.

Prerequisites

Load order

  1. Confirm forms and all definition versions are already present.
  2. Prepare the response extract and remap its reference fields.
  3. Insert FormResponse__c.
  4. Optionally re-link created records and files.

Step 1: extract the responses

SELECT Id, Name, Form__c, Type__c, Data_Version_ID__c, FormJSON__c,
       New_Record_ID__c, Main_Record_DML_Operation__c,
       Account__c, Contact__c,
       StartTime__c, LastUpdateTime__c, Package_Version__c, CreatedDate
FROM FormResponse__c
WHERE Type__c = 'COMPLETE'

Keep the source Id column so you can build a response map for any downstream re-linking.

Step 2: remap the reference fields

Before inserting, rewrite three things on every row.

Form lookup

Replace Form__c with the new Form__c Id from your form migration map. A response with a dangling form lookup will not preview.

Data Version id, the critical remap

Replace Data_Version_ID__c with the new ContentVersion Id from the version map. Join on the source ContentVersion Id:

source Data_Version_ID__c  ->  (version map)  ->  new ContentVersion Id

Example map join:

responseSourceId,sourceDataVersionId,newDataVersionId
a1X...001,068AA0001,068ZZ9001
a1X...002,068AA0001,068ZZ9001
a1X...003,068AA0007,068ZZ9042

Two responses answered on the same form version share a source Data Version id and must both map to the same new one. If a source Data Version id has no entry in the map, you did not migrate that version. Stop and migrate full history before continuing, do not guess or fall back to latest.

Answer JSON

FormJSON__c holds the submitted answers as text and moves as is. It contains values, not Salesforce Ids, so it needs no remap. If a form stored record Ids inside answers for lookups, those Ids are stale but they do not affect preview rendering.

Step 3: insert the responses

Insert FormResponse__c with the remapped fields. Type__c is required; keep the source value so COMPLETE responses stay complete. The response trigger auto populates Account and Contact lookups from the Main Record type, so leave those to be set by migration only if the referenced records exist in the target org. See Form response and automatic mapping.

Step 4: created records and files, optional

A response can reference business records and files created at submission time.

Step 5: verify by previewing

Verification for responses is not a record count, it is a replay. Preview is what proves the migration worked.

  1. Open a migrated response and click Preview Submission, or open b3f__PreviewForm?id=<newResponseId>.
  2. Confirm it renders read only with the submitted answers filled in.
  3. Confirm it renders against the correct version. Pick a response answered on an older form version and confirm preview shows the old layout, not the current one. That proves the Data Version remap is correct.

Test at least one response per distinct source Data Version id. A response that previews blank or against the wrong layout almost always has a bad Data_Version_ID__c.

Disaster recovery note

For a restore, the same rules apply, but the version map is your recovery key. If you restore responses without also restoring the exact definition versions they were pinned to, the responses survive as records but can never be replayed. Back up the definition Files and their full version history alongside the response records, and keep the source ContentVersion Id to new ContentVersion Id map with the backup. Without it, a restored response is an orphan.

Common failures

Symptom Cause Fix
Preview loads blank or errors Data_Version_ID__c points at a version Id that does not exist in this org Remap against the version map, migrate full history if the version is missing
Preview shows the current form, not the submitted one Data_Version_ID__c left as source Id and coincidentally resolved, or repointed to latest Repoint to the exact matching new ContentVersion Id
Response has no form Form__c lookup still holds a source Id Repoint using the form migration map
Account or Contact blank on the response Referenced records not migrated Migrate the business records first, or accept the gap