You need to sign in to do that
Don't have an account?
Aidan Keenan
I want to use an encrypted custom field in an e mail template?
I want to use an encrypted custom field in an e mail template. I want the field to be visible to the recipient of this e mail. Here is the code that gets the custom field from the record in the visualforce e mail template Encrypted Account Number: {!relatedTo.ts2__Employee__r.Sample_Bank_Acc__c} Is there a way of doing this?
You can use encrypted fields in email templates but the value is always masked, regardless of whether you or the recipient have the “View Encrypted Data” permission.
The only means of displaying the encrypted value would be by using the <apex:outputField> component in a Visualforce email template, as this is the only component that supports presenting encrypted fields in Visualforce pag(email template).
- make the field public but encrypt it before saving it in the record, and decrypt before adding it to the template. This however will require keeping the field synced at all time and adding a custom component to the email template.
The above workaround would require you to code more...
<messaging:attachment >
Encrypted Account Number: <apex:outputField value="{!relatedTo.ts2__Employee__r.Sample_Bank_Acc__c}"/>
</messaging:attachment>
This allowed me to use the apex outputField in the e mail tempplate, however the bank account number remains encypted when I open the attachment.