0

I made some modifications on the system administrator profile, i am working on a sandbox and i need to deploy these changes to the production, the requirements are to deploy only the modifications that i have made not all the profile.

I use ant to deploy and i have this XML file, but this pushes all the profile and not only the modifications i made, de you have an idea how to do that ?

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
  <types>
      <members>Contact</members>
      <name>CustomObject</name>
  </types>
  <types>
      <members>API User 2</members>
      <name>Profile</name>
  </types>
    <version>33.0</version>
</Package>

Note: The changes are made on two fields on the contacts object.

  • Include the fields in the package xml as well. – Dave Humm Nov 30 '16 at 13:51
  • but , i already included the whole object Contact – Merabti Ibrahim Nov 30 '16 at 13:57
  • or you suggest to replace the object by the fields on which the modifications took place – Merabti Ibrahim Nov 30 '16 at 13:58
  • I would include just the fields as the security settings will be in their metadata if I remember correctly. – Dave Humm Nov 30 '16 at 14:22
  • i did as you said, hope it going to work – Merabti Ibrahim Nov 30 '16 at 14:58
2

If you can create a package to download completely the Profile, you will have something like this (the Admin profile in my case):

<?xml version="1.0" encoding="UTF-8"?>
<Profile xmlns="http://soap.sforce.com/2006/04/metadata">
    <applicationVisibilities>
    ...
    <classAccesses>
    ...
    <custom>false</custom>
    <fieldPermissions>
        <editable>true</editable>
        <field>Account.Active__c</field>
        <readable>true</readable>
    </fieldPermissions>
    ...
    <layoutAssignments>
    ...
    <objectPermissions>
    ...
    <pageAccesses>
    ...
    <recordTypeVisibilities>
    ...
    <tabVisibilities>
    ...
    <userLicense>Salesforce</userLicense>
    <userPermissions>
    ...
</Profile>

Once you have it downloaded, edit the Profile XML, remove everything but your fields (fieldPermissions nodes), change the properties in the nodes (editable, readable, if needed), create a package with only the Profile and deploy it (you can create the Profile's XML file from scratch too).

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
  <types>
      <members>API User 2</members>
      <name>Profile</name>
  </types>
    <version>33.0</version>
</Package>

And the Profile XML will be something like

<?xml version="1.0" encoding="UTF-8"?>
<Profile xmlns="http://soap.sforce.com/2006/04/metadata">
    <custom>false</custom>
    <fieldPermissions>
        <editable>true</editable>
        <field>Contact.MyField1__c</field>
        <readable>true</readable>
    </fieldPermissions>
    <fieldPermissions>
        <editable>true</editable>
        <field>Contact.MyField2__c</field>
        <readable>true</readable>
    </fieldPermissions>
    <userLicense>Salesforce</userLicense>
</Profile>
  • Yes , it is clear now, thanks alot for the detailed answer – Merabti Ibrahim Dec 1 '16 at 9:09
0

You have to modify the xml of the profiles that you are deploying to include the definition only of the affected fields.

In your example you should have API_User_2 profile file in the profile folder. You need to remove everything apart from the modifications that you want to transfer. After that you only need to deploy the profile itself using ant - so you don't need to include objects or fields in the package.xml. Everything inside the profile file will be applied to the organisation that you deploy to.

  • I am really confused, you said i have to include the definition of affected fields and then you said so you don't need to include objects or fields in the package.xml , is't that a contradiction ? – Merabti Ibrahim Nov 30 '16 at 16:58
  • Can you please illustrate by an example , that would be great – Merabti Ibrahim Nov 30 '16 at 17:00
  • I didn't say to include fields into package xml - someone else did. – Artur Nov 30 '16 at 21:36
  • To retrieve the profile with field level security settings for a specific object you need to include these fields into the package.xml and perform the retrieve operation. To deploy the profile you need to modify the xml inside profile file and only have package.xml with referenced profile - you don't need the fields at that point. Make sure that the file hierarchy has only the items you specify in the package xml when you deploy. All of that assumes you are using ANT and not change sets. – Artur Nov 30 '16 at 21:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.