1. General information
The functionality prepares test data in Documents of a predefined Folder for later use as a data source for other instances. It will go up in hierarchy of SObjects, to parents of records retrieved with specified filters and parents of parents and so on up until there are no more Id references.
A Developer Sandbox folder on can be created on source org, which is Production, which is populated with Documents containing test data. This folder is for general purpose use for all developers and can be prepared based on feedback of experienced Salesforce consultant who knows the system well and what data is important for testing purposes (see Pic. 2.1, Table 2.1).
If there is a need to create another data set there can be a different folder created.
The system tracks origin org and target org records' Ids which allows deduplication. It is possible to delete records inserted from folder by clicking Delete Inserted Data button (see Pic. 3.1).
2. Prepare test data in source organisation
2.1. Go to /015. Click Create New Folder. Enter folder name that will hold Documents with test data.
2.2. Go to /apex/Ide#/editor/newFolderWithData by clicking Create Test Data from CSVs option in a menu shown on Pic. 2.1.
2.3. Copy contents of the Table 2.1 below and paste them into Filter table on newFolderWithData page, Pic. 2.2. Replacement Map table should be empty. This is just an example. The filters can be different depending on what kind of test data is needed.
Pic. 2.1. Menu.
|CampaignMember||Campaign.Name = 'DM Campaign to Top Customers - Nov 12-23, 2001'|
|Opportunity||Account.Name = 'Express Logistics and Transport'|
|Contact||Account.Name = 'Express Logistics and Transport'|
|Case||Account.Name = 'Express Logistics and Transport'|
Table 2.1. Example of test data filters.
Pic. 2.2. Filters input.
2.4. Specify target Folder name. In this case it is Campaign Data (for this example). If the folder already contains test data it will not be destroyed by the new request - it will be merged in case if new records appear. If there no new records - the data will not be changed.
2.5. Click Submit filter.
2.6. If all went well you will see the screen shown on Pic. 2.2.
Pic. 2.3. Successfully submitted.
2.7. A batch job will start and it will take up to several hours depending on amount of data and how busy QA Sandbox is. The jobs are chained, one starts the other one. It might appear that no more batches are running, but that might not be the case as processing of the next one might start with delay as QA Sandbox is crowded with other batch jobs, 2 minutes without indication of the new HighVolumeCsvTestDataProvider batches running is safe assumption that the process is complete. There will be an email notification implemented later. It is recommended to wait until all of the batches complete running otherwise the data package will not be stable enough to use for import in another organisation.
2.8. As the processing progreeses you will see a table with provessing results, see Pic. 2.3.
Pic. 2.4. Batch jobs status custom layout.
2.9. When checking batch job results on standard Salesforce batch list page you will be able to see something similar to what is shown on Pic. 2.3.
Pic. 2.5. Batch jobs status standard layout.
Pic. 2.5. Campaign data folder.
3. Import the test data from source into target organisation
3.1. Add endpoints https://test.salesforce.com/services/Soap/c/31.0 and https://login.salesforce.com/services/Soap/c/31.0 by going to Setup -> Security -> Remote site settings.
3.2. Go to /apex/Ide#/createTestDataFromCsvs
Pic. 3.1. Form for entering Folder name, username, and password + security token.
3.3. Click Submit button.
A batch job will login into source organisation using credentials provided, pull the Documents records from Campaign Data folder and insert them into the current organisation.
If an error appears saying "CSV Strategy is null" it most likely means that build Document in target folder contains warning about unresolved dependencies. Please adjust the build file in this case. The build file contains replacement map (if Replacement Map table on step 3.2 was populated with some values) and order of inserting SObject records. If there is a warning at the top of the build Document saying that there were circular references detected, the insert order of mentioned SObjects needs to be determined manually by editing the build and reuploading it again.
Pic. 3.2. Example of the build file from source organisation.
If the processing went through successfully the records from the Documents will be inserted into target organisation.
Button Delete Inserted Records, Pic. 3.1, can be used to delete the records as the system keeps track of the Ids in cache Document in source organisation.