As anyone using Shield encryption knows, there are all sorts of considerations documented here:
- General Shield Platform Encryption Considerations
- Considerations for Using Deterministic Encryption
- Use Encrypted Data in Formulas
None of these are relevant
Upon detailed investigation, the issue appeared to be pod-related
- PROD: failed (na81)
- Staging: works fine (cs62)
- Dev sandbox: failed (cs43)
That is, the identical formula field referencing identical cross-object encrypted (probabilistic) fields rendered NULL in two pods but not a third.
The workaround was surprising:
- Create a new custom formula field on Case called
My_Identifier_Clone__c
. Copy-paste the exact same formula as inCase.My_Identifier__c
. - Change the references to the formula field in the Email Template to be
{!Case.My_Identifier_Clone__c}
- Retest - email renders correctly
I suspect I could also have deleted the original formula field Case.My_Identifier__c
and add back but this would be problematic to deploy through a Devops pipeline without two steps