function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Obulesh RajObulesh Raj 

object permission migration with profile

I have migrated profile using dream factory snapshot from sandbox a to b but object permissions didn't get migrated to b? Is there any solution to get object permission migrated?
Best Answer chosen by Obulesh Raj
Rahul KumarRahul Kumar (Salesforce Developers) 
Hi Obulesh,
In order to change the Object Permissions in one or more profiles, you will have to first retrieve the object along with the profiles.
 
For instance, my package.xml to retrieve the files will be as follows:
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="<a href="http://soap.sforce.com/2006/04/metadata" target="_blank" rel="nofollow">http://soap.sforce.com/2006/04/metadata</a>">
    <types>
        <members>Test__c</members>
        <name>CustomObject</name>
    </types>
    <types>
        <members>*</members>
        <name>Profile</name>
    </types>
    <version>27.0</version>
</Package>


This will give me all the Profiles metadata along with the object (Test__c).  If I open any profile metadata file, this is how it looks.
<?xml version="1.0" encoding="UTF-8"?>
<Profile xmlns="<a href="http://soap.sforce.com/2006/04/metadata" target="_blank" rel="nofollow">http://soap.sforce.com/2006/04/metadata</a>">
    <fieldPermissions>
        <editable>true</editable>
        <field>Test__c.Contact__c</field>
        <readable>true</readable>
    </fieldPermissions>
    <fieldPermissions>
        <editable>true</editable>
        <field>Test__c.Opportunity__c</field>
        <readable>true</readable>
    </fieldPermissions>
    <fieldPermissions>
        <editable>true</editable>
        <field>Test__c.User__c</field>
        <readable>true</readable>
    </fieldPermissions>
    <objectPermissions>
        <allowCreate>false</allowCreate>
        <allowDelete>false</allowDelete>
        <allowEdit>false</allowEdit>
        <allowRead>false</allowRead>
        <modifyAllRecords>false</modifyAllRecords>
        <object>Test__c</object>
        <viewAllRecords>false</viewAllRecords>
    </objectPermissions>
    <userLicense>Salesforce</userLicense>
</Profile>

In the profile file, you will have to change the values under the <objectPermissions> tag. Once saved, you can then deploy the profile along with the object file. You can use the same package.XML file, you used to retrieve.
https://developer.salesforce.com/forums/?id=906F0000000AanOIAS
 
Hope this helps.

Please mark it as best answer if the information is informative.so that question is removed from an unanswered question and appear as a proper solution.