29

The following error pops up when I am trying to move all the meta data from one environment to another (with Profiles).

You cannot deploy to a required field Object_Name__c.Field_Name__c

Upon investigation, the field is a required field on layout and that's the reason deployment is throwing the error.

Now, I am skipping the fields using ANT's replaceregexp to do the deployment?

Any better way to deal with this problem?

1 Answer 1

37

In API version 30.0 and later, permissions for required fields can’t be retrieved or deployed. So make sure your profiles/permission sets don't reference any required fields.

See "ProfileFieldLevelSecurity" in the Metadata API Developer's Guide: http://www.salesforce.com/us/developer/docs/api_meta/Content/meta_profile.htm See "fieldPermissions" under "Profile" on page 338 of the Spring '14 release notes: https://help.salesforce.com/help/pdfs/en/salesforce_spring14_release_notes.pdf

Hope that helps.

6
  • 6
    I feel like I'm missing something... So, how are permissions for required fields expected to be moved between orgs after release 30? Seems like an impractical change.
    – CDelaney
    Jul 21, 2014 at 16:23
  • 7
    If the field is required, then all profiles must have read and edit access by default. So, no need to include them in permission definitions. Aug 8, 2014 at 20:54
  • Same question as CDelaney, I have an org where I have a required field on the layout but the field permission is missing. If it expects the read/write access by default, does it not set that info automatically? I'm trying to deploy to it (rather than manually changing) but getting this error. Is this just a bug where I need to update the permission manually? Also @Cas, I looked through the documentation you referenced and not finding the information; can you confirm the documentation or references in the documentation is accurate?
    – zainogj
    Jul 6, 2015 at 15:48
  • If you create a new custom field and check 'Required', Field Level Security automatically becomes 'Visible' for all profiles. Similarly, if you edit the definition of a custom field which is not visible to all profiles and check 'Required' then it automatically becomes visible to all profiles. Therefore there is no need to reference it in a permission set. Try it!
    – MikeA
    May 10, 2018 at 15:39
  • 1
    Has anyone found a solution to this? The idea of editing the XML to exclude all required fields from all profiles is absurd, IMO.
    – ScottH7a9
    Oct 14, 2018 at 12:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .