function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
rscottrscott 

Encrypted fields not saving properly

I having an issue with encrypted fields not saving. Weird issue. Here's how to reproduce it:

 

1. On a custom object, create an encrypted text field. Mask Type = Mask All Characters, Mask Character = *

 

2. Log in as a user whose profile does NOT include the permission 'View encrypted data'.

 

3. Save a record with a value in your new encrypted field.

 

4. Note what that value is either by logging in as someone who has the 'View encrypted data' permission or by doing some anonymous Apex. (or just remember what you typed in step #3, i guess)

 

5. Edit that same record, but only change the encrypted field and change it to another value with the same length.

ex. initial value = "Test123", change to "Test456". each value has 7 characters.

 

6. Find that value using the same method as #4. 

 

In my tests, the value found in #4 is the same as in #6.

 

If you edit the field with the 'View encrypted data' permission, it works fine. If the encrypted field is set with a mask of 'Last Four Characters Clear', it works fine. And if you also edit a different non-encrypted field at the same, it works fine. You have to have encryption turned on in your org, so if you don't you won't get past step 1. I'm curious if anyone else has experienced this or can reproduce it. Seems like a bug to me.

chuckmortimorechuckmortimore

Yes, it's a known bug, and will be addressed in a future release.    In the meantime, the workaround is to delete the value, save, then put in the new value and save again. 

 

This workaround only needs to be done when the new value would not affect the non-masked data.