Force.com IDE – Profile Deployment Error with Required Field

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?

Best Answer

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.