I'm trying to create a unique email constraint on our Contact object, the general consensus seems to be to create a new, unique custom field, and copy the Email field into it via a trigger or workflow.

I did this successfully in a sandbox, and added the elements to a change set to deploy into the Production environment.

The deployment failed with the message:

Can not specify 'caseSensitive' for a CustomField of type Email

When I mark an email field as "Unique" I'm not asked to specify the case sensitivity (unlike Text fields), but using workbench I can confirm that the field is marked as caseSensitive = true.

Field Editor:

No case options for Email field type

Object Description:

Case Sensitive: true

To be honest I'd prefer the field to case insensitive, so this would appear to be an issue with the UI, but other than creating my field as a text field and setting the case sensitivity myself, is there a work around that will allow me to continue working with the Email field type?

Edit to note

Turns out that my sandbox instance had been updated (to Spring '19) while Production hadn't, resetting the sandbox to the same version as Production (Winter '19) allowed the deployment to complete even though the email field was still "case sensitive".

1 Answer 1


Email fields, for better or for worse, automatically lowercase values. There's no point in being case-sensitive because all values are transformed to lowercase values. As such, you'd get this error because email fields are automatically handled according to Salesforce logic.

  • That indeed appears to be the case - however I'm not given the option to select whether I want it or not, and the UI sets it incorrectly :( Other than using a text field is there a way to correct the metadata manually before I create the change set? Jan 17, 2019 at 16:25
  • @Zhaph-BenDuguid No, the API is setting this directly. A change set should work okay, but API-based calls (e.g. metadata) might need to be manually edited.
    – sfdcfox
    Jan 17, 2019 at 16:27
  • Sorry if I wasn't clear, the change set deployment fails with the stated message, so I wanted to change it (clearly via an API, but didn't find much about updating existing fields with the Metadata API) and then create a more "valid" change set. Jan 17, 2019 at 16:31
  • 1
    @Zhaph-BenDuguid Oh, my misunderstanding. Unfortunately, I think you'll need to contact support to fix this.
    – sfdcfox
    Jan 17, 2019 at 16:34
  • Thanks for your help - turns out that my sandbox had been upgraded to Spring '19 while production was still Winter '19 and this apparently caused it to fail. Resetting the sandbox to Winter '19 seems to have resolved the issue. Feb 1, 2019 at 10:30

You must log in to answer this question.

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