We have a customer who wants to use Shield Platform Encryption but that has the constraint that you Can't reference encrypted fields in Formula Field Types with these alternatives suggested:
- Use WF field to set a field instead of a formula.
- Build the same rule programmatically in APEX, store in a custom Text field and apply encryption on it.
- Alternatively, if the formula is used to concatenate text to be merged into a VF page, concatenate the encrypted fields in the controller instead, in runtime, vs storing it in a field.
- Limited support in Winter’17 (safe harbor).
The problem though is that we have such formula fields in a managed package and so cannot change their field type. Further we have multiple customers using those fields... I'm hoping (but fearing it won't be possible) for a solution that doesn't break the existing customers; the formula being blank for customers that turn on Shield Platform Encryption would be fine because we could set them up with one of the work arounds.
Something like being able to reference a field by a name obtained from a custom setting (a dynamic rather than static reference) would work but I don't think any such mechanism exists. Or perhaps there is no getting away from changing the formula to point to a trigger-updated non-encrypted field that programmatically checks whether encryption is on and if so leaves itself blank else copies the value.