In the Cloud Compliance application, the “Data Portability” feature uses mappings that store data in the custom objects available in a package. This document showcases how Object mappings upto Nth Level can be transferred from one org to another in order to efficiently migrate data from sandbox to production.
Process Summary
The first step of the data migration process is to extract the CSV files from the source org that contains the mapping data. Extraction can effortlessly be done using Workbench. When the CSV files are ready, these files need to be pushed into the destination org using Workbench. We illustrate this process in detail, below.
This document should be used only as a reference guide as every Org is different and has its unique objects and structure.
Prerequisites
Before starting the Data Migration process, the user needs to create a custom field (data type – Text) with the name “External Id” on the objects i.e. ‘Data Portability Master’ and ‘Data Portability Detail’ in the destination Org. This custom field should be of type ‘Text’, Case Sensitive, and ‘Unique Record Identifier from an external system’.
Solution Steps –
Data migration for Data portability
Total Objects : 3
- Data Portability Master
- Data Portability Detail
- Data Portability Field Mapping
1. Data Portability Master
API Name : PCCC_DM__Data_Portability_Master__c
To create a CSV file, the workbench SOQL for Data Portability Master should be as follows –
Select Id, Name, PCCC_DM__Description__c, PCCC_DM__Target_Object__c, PCCC_DM__isActive__c, PCCC_DM__isCustom__c FROM PCCC_DM__Data_Portability_Master__c
Push the CSV file in Destination org using Workbench.
- Click on Data -> Insert then Select object and CSV file that needs to be pushed in a destination.
- Map Fields
Map ‘External_Id__c’ with ‘Id’
2. Data Portability Detail
API Name : PCCC_DM__Data_Portability_Detail__c
Data Portability Detail may contain objects till Nth level in the mapping. Create a separate CSV for each level using the managed package custom field “Running Index”.
Note – Running Index starts from 0, 100, 200, 300…. and so on. Parent object does not have a Running Index value. So, all the Level 1 objects in the mapping will have a Running Index of 0, Level 2 objects will have a Running Index of 100, Level 2 objects will have a Running Index of 200, and so on.
- To create a CSV file for Data Portability Detail records containing only Level 1 objects, the workbench SOQL should be as follows –
Select Id, Name, PCCC_DM__Data_Portability_Detail_Mapping__c, PCCC_DM__Data_Portability_Master__c, PCCC_DM__Filter_Field__c, PCCC_DM__Object_Name__c, PCCC_DM__Type__c, PCCC_DM__isCustom__c, PCCC_DM__relationShipField__c,PCCC_DM__Running_Index__c, PCCC_DM__relationShipName__c FROM PCCC_DM__Data_Portability_Detail__c WHERE PCCC_DM__Running_Index__c =0
Push the CSV file in Destination org using Workbench.
- Click on Data -> Insert and select object type Data Portability Detail with Level 1 CSV file that needs to be pushed to a destination.
- Map Fields
- ‘External_Id__c’ with ‘Id’
- ‘PCCC_DM_Portability_Master__c’ with Smart Look Field i.e ‘PCCC_DM_Portability_Master__c.External_Id__c’.
- To create a CSV file for Data Portability Detail records containing only Level 2 objects, the workbench SOQL should be as follows –
Select Id, Name, PCCC_DM__Data_Portability_Detail_Mapping__c, PCCC_DM__Data_Portability_Master__c, PCCC_DM__Filter_Field__c, PCCC_DM__Object_Name__c, PCCC_DM__Type__c, PCCC_DM__isCustom__c, PCCC_DM__relationShipField__c,PCCC_DM__Running_Index__c, PCCC_DM__relationShipName__c FROM PCCC_DM__Data_Portability_Detail__c WHERE PCCC_DM__Running_Index__c = 100
Push the CSV file in Destination org using Workbench.
- Click on Data -> Insert and select object type as Data Portability Detail with Level 2 CSV file that needs to be pushed in a destination.
- Map Fields
- ‘External_Id__c’ with ‘Id’
- ‘PCCC_DM__Data_Portability_Detail__c ’ with Smart Look Field i.e ‘PCCC_DM__Data_Portability_Detail__c.External_Id__c’.
- ‘PCCC_DM_Portability_Master__c’ with Smart Look Field i.e ‘PCCC_DM_Portability_Master__c.External_Id__c’.
The below screenshot shows the first two mapping fields –
The one below shows the third mapping field –
- To create a CSV file for Data Portability Detail records containing only Level 3 objects, the workbench SOQL should be as follows –
Select Id, Name, PCCC_DM__Data_Portability_Detail_Mapping__c, PCCC_DM__Data_Portability_Master__c, PCCC_DM__Filter_Field__c, PCCC_DM__Object_Name__c, PCCC_DM__Type__c, PCCC_DM__isCustom__c, PCCC_DM__relationShipField__c, PCCC_DM__Running_Index__c, PCCC_DM__relationShipName__c FROM PCCC_DM__Data_Portability_Detail__c WHERE PCCC_DM__Running_Index__c = 200
Push the CSV file in Destination org using Workbench.
- Click on Data -> Insert and select object type as Data Portability Detail with Level 3 CSV file that needs to be pushed in a destination.
- Map Fields
- ‘External_Id__c’ with ‘Id’
- ‘PCCC_DM__Data_Portability_Detail__c ’ with Smart Look Field i.e ‘PCCC_DM__Data_Portability_Detail__c.External_Id__c’.
- ‘PCCC_DM_Portability_Master__c’ with Smart Look Field i.e ‘PCCC_DM_Portability_Master__c.External_Id__c’.
Likewise, we can create Object Mapping CSV upto Nth Level objects and push it to the destination org.
3. Data Portability Field Mapping
API Name : PCCC_DM__Data_Portability_Field_Mapping__c
To create a CSV file, the workbench SOQL for Data Portability Field Mapping should be as follows -:
Select Id, Name, PCCC_DM__Data_Portability_Master__c, PCCC_DM__Field__c, PCCC_DM__Object__c, PCCC_DM__Type__c, PCCC_DM__User_Friendly_Label__c FROM PCCC_DM__Data_Portability_Field_Mapping__c
Push the CSV file in Destination org using Workbench.
- Click on Data -> Insert then Select object and CSV file that needs to be pushed in a destination.
- Map Fields
Map field ‘PCCC_DM_Portability_Master__c’ with Smart Look Field i.e ‘PCCC_DM_Portability_Master__c.External_Id__c’.
Now users can check Portability Mapping in the destination org.