Deployment commits data in "Check Only" option
Last updated 2018-02-10 ·Reference W-4312201 ·Reported By 2 users
When a deployment is being done in "check only" mode using Force.com Migration Tool and if any of the components contain field conversion from lookup to master-detail, validating the deployment package causes all the sharing configuration (sharing rules and share records) for the entity being on detail side of master-detail to be deleted. Note that the conversion itself does not happen.
** UPDATE **
If you change a field type from Master-Detail to Lookup or vice versa, that change isn't supported when using the *checkOnly* option to test a deployment (validation). This change isn't supported for test deployments and inbound change set validations to avoid the risk of data loss or corruption. If a change that isn't supported for test deployments is included in a deployment package or a change set, the test deployment fails and issues an error.
If your deployment package changes a field type from Master-Detail to Lookup or vice versa, you can still validate the changes prior to deploying to Production by performing a full deployment to another test Sandbox. A full deployment includes a validation of the changes as part of the deployment process.
1. Start with new Developer Org.
2. Create a new custom object called TestLead with API name TestLead__c
3. Add two custom fields to TestLead.
3a Account lookup called Account (API Name Account__c)
3b Text field called RuleCriteria__c
4. Create a public group called GroupG1. The group does not have to have any members.
5. Change Org wide default for Account and for TestLead to private using Sharing Settings Page.
6. Once OWD (step 5) change is completed, add a criteria based sharing rule to TestLead object.Rule name and criteria can be anything.Make sure it is Criteria Based rule. For example something like RuleCriteria__c="foo"
7. Add a custom tab for TestLead object to make it easier to create new records.
8. Create a new TestLead record. Make sure that the record satisfies condition you used for CBS rule in Step 6
9. Navigate to workbench and execute a query against Referral__Share
SELECT AccessLevel,Id,IsDeleted,LastModifiedById,LastModifiedDate,ParentId,RowCause,UserOrGroupId FROM Referral__Share
you should see two records. One with rowCause=owner and another with rowCause=rule
If you do not see it, you did something wrong in the steps above.
10. Use workbench to run deployment.
10a on WB select Migration >> Deploy from the menu
10b use browse option to select your zip file
10c check "Check Only" option
10d click "next" and "deploy" on next screen
10e wait for the screen to refresh few times until deployment is completed. If you did all steps correctly it will succeed.
11. Use WB to re-execute query from step 9. You should see no records this time - the owner shares and the rule shares are deleted now
12. Go back to the Sharing settings page of the Org and check that sharing rule you created in step 6 is gone as well.
Do not include such conversion into the package used for "check only" deployment.
Is it Fixed?
Any unreleased services, features, statuses, or dates referenced in this or other public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make their purchase decisions based upon features that are currently available.