1

trying to grab data from an external system and use it to update Contact records in Salesforce. 99% of the time this works great, but I've recently seen the following error that is a bit puzzling since the First Name I'm attempting to write in is only 20 characters long:

Contact.FirstName = externalUserData.firstName

Ciphertext of length 127 bytes can't be written into a column of length 120 bytes for the "Contact.FirstName" field for Entity Id...

Is this unrelated to the length of the field? Some searching brought up Shield encryption but I can't find this error or documentation on that so any help would be much appreciated!

5
  • Please edit your question and provide a Minimal, Reproducible example that shows how you arrive at this error message
    – identigral
    Jul 6 at 19:45
  • Have you implemented Shield Platform encryption and are you encrypting the First Name field?
    – Rajiv
    Jul 6 at 19:45
  • @identigral added more code above
    – McD
    Jul 6 at 20:48
  • @Rajiv yes to both of your questions
    – McD
    Jul 6 at 20:48
  • 1
    It seems that encrypted value might be exceeding the field length. Check out the following:
    – Rajiv
    Jul 6 at 22:07
1

It seems that encrypted value might be exceeding the field length. This can happen if you are using deterministic encryption mechanism. It also depends on character set used. You would have to implement validations so that the length of the value in these fields does not exceed certain length.

Check out the following:

https://help.salesforce.com/articleView?id=security_pe_considerations_standard_fields.htm&type=0

https://stackoverflow.com/questions/6486121/why-is-the-ciphertext-32-bytes-long-when-encrypting-16-bytes-with-aes

1
  • While this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.
    – identigral
    Jul 8 at 17:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.