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
Robert Baillie 5Robert Baillie 5 

Difficulty managing access to Document using Profiles and the Metadata API

We are having trouble managing the permissions associated with Document via the Metadata API.

We are using ant to both deploy and retrieve the metadata files.

In order to deploy successfully we can:

Add the following xml to a .profile file.
 
<objectPermissions>
    <allowCreate>true</allowCreate>
    <allowDelete>true</allowDelete>
    <allowEdit>true</allowEdit>
    <allowRead>true</allowRead>
    <modifyAllRecords>true</modifyAllRecords>
    <object>Document</object>
    <viewAllRecords>true</viewAllRecords>
</objectPermissions>

Ensure Document is not in the CustomObject section of the package.xml

This updates the permissions on the profile correctly.

However, this change is not included in the .profile file when we do a retrieve.

In order to retrieve successfully we can add the Document element to the CustomObjects section of the package.xml

On doing so we get the warning:
package.xml - Can't retrieve non-customizable CustomObject named: Document
And the retrieve does not bring down a definition for the Document object.
This would be fine, but if we include the Document node in the package.xml and do not include a definition for that object then future deploys we get:
package.xml (Document) -- Error: An object 'Document' of type CustomObject was named in package.xml, but was not found in zipped directory
The whole deployment then fails.

Is anyone aware of a single configuration in the package.xml that will result is successful deployments and retrievals of the Document permissions in profiles?