Skip to main content

Why can't I deploy "<ViewAllFields>" changes

This document explains why you may not be able to deploy "<ViewAllFields>" changes and the current workaround to this issue.

Richard Terry avatar
Written by Richard Terry
Updated this week

This issue is believed to be resolved in most Salesforce instances.

The remaining affected instances are as follows:

CS115, CS116, CS137, CS148, CS151, CS152

Full details from Salesforce are documented here.

Explanation of the issue with "ViewAllFields" changes

Starting with API v63, Salesforce introduced <ViewAllFields> permissions for Custom objects.

When deployed, this field will give "view" permissions to all fields in an object.

With the way <ViewAllFields> changes are currently being handled by the Metadata API, this change will not be deployed unless you also include at least one other field change in the deployment.

Example

If you are planning to deploy the following in one of your permission sets to grant viewAllFields = true.

<objectPermissions>
<object>Account</object>
<viewAllFields>true</viewAllFields>
</objectPermissions>

You would also need to include one of the fields from the account object.

  <fieldPermissions>
<editable>true</editable>
<field>Account.AccountNumber</field>
<readable>true</readable>
</fieldPermissions>

If you do not include one of the fields, the deployment will be successful but the change will not reflect in the target org.

Salesforce have confirmed this is an issue, the current fix for this is shown here.

Unfortunately, when you retrieve the ViewAllFields change from Salesforce, it will not retrieve the fields being shown as readable = true.

This means that the above fix does not work in Gearset unless you manually make the changes in a deployment package file in your Version Control System (e.g. GitHub, Azure DevOps, Bitbucket etc).

Solution

Gearset has an automatic fix for this issue that should solve this automatically if you are making your deployment in Gearset (via Compare and deploy or CI jobs).

This solution works in most cases but we are aware of a few edge scenarios where the issue persists despite our fix. In these cases you will be required to follow the solution above.

If you are still facing this issue, please feel free to reach out via the In-app chat and we can help confirm what is going on.

Did this answer your question?