Print this page

Encrypted fields are being masked in a VF page when embedded into a standard layout

Knowledge Article Number 000005945

Custom encrypted fields are being masked in a VF page embedded into a standard layout when they should be displayed in full text. The visualforce page works fine as long as it’s viewed independently. As soon as this VF page is embedded in a standard page layout, it no longer decrypts the value.


The workaround is to embed a second iFrame into the Visualforce page. Here is a sample. It requires two VF pages, the first would be embedded into the Standard page.

**Page Name: testEncrypted**

<apex:page standardController="Account">
 <apex:iframe src="/apex/testEncrypted2?id={!Account.Id}" scrolling="false" id="myFrame"/>

**Page Name: testEncrypted2**

<apex:page standardController="Account" showHeader="false" sidebar="false">
 Output Field: <apex:outputField value="{!Account.encrypted__c}" /><br />
 Output Text: <apex:outputText value="{!Account.encrypted__c}" /><br />
 Clear: {!Account.encrypted__c}<br />

promote demote