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
rvkrvk 

how to access the encrypted field values

how to display the actual values of the encrypted text field values in a visual force page.please help me out.

colemabcolemab

You need the "View Encrypted Data" check box to be checked under your profile type in the section titled "General User Permissions".

rvkrvk

 the process is when click on the custom button with in a custom object record it will redirect to visual force page to renderAs pdf and  creates a pdf attachment to the record. when click on the view option at attachment related list then these encrypted values have to be displayed in pdf. I tried this process even after assigning the permission but it didnt work.

Shashikant SharmaShashikant Sharma

Even though I also think that after assigning View Permissions for the profile for encrypted field your issue should have fixed, just not render this page as PDF and see it on VFP or not. 

rvkrvk

when the page is displayed as vf page it is working fine but when rendering that page as pdf then it is diplaying data as "XXXX".

Shashikant SharmaShashikant Sharma

Do one thing istead of binding this with inputField just copy value in a string and show it using outPut Lable.

 

let me know if you have any issue in it.

rvkrvk

i tried copying the encrypted value to a string even  it didnt work.

rvkrvk

any thoughts....

colemabcolemab

According to this idea on the idea exchange from 2008, you can't display encrypted fields in renderasPDF mode for VF pages.

ApexPreyApexPrey

Sorry, rvk, that I didn't see your post earlier. We had a major struggle with this bug last month. When rendering a VF page to PDF the server process ignores the encrypted field policy settings and always displays asterisks as field values (probably due to the fact that SFDC is using 3rd-party code). We reported the error and indicated that this was a showstopper bug for our company. We got some nice comments from the support team, but I don't think they ever really understood and/or appreciated the issue. As such we were forced to find a workaround - or else simply abandon all our SFDC development and go with another cloud platform. After some frantic days we came up a solution based on the 'forward view state' mechanism which enables you to establish a view state within a VF page and then invoke a server-side redirect to another VF page that specifies exactly the same controller, controller extension and field state. In this case, the controller and extension constructor is executed only once, during the rendering of the first page. By referencing all the required fields in the first VF page (using Apex output elements with rendered="false") the encrypted fields are processed correctly and their clear text values are passed securely to the second VF page which does the render to PDF. Let me know if you need more info or code samples and I'll be happy to provide them.

 

srikeerthisrikeerthi

Hi

 

I am also working on the same scenario,can you please post the code which worked for 

displaying the Encrypted value on VF page which is rendered as pdf.

 

 

 

Thanks

ApexPreyApexPrey

I would be happy to. Give me a day or so to put together some sample code.

 

Regards

srikeerthisrikeerthi

Hi

 

Can you Please post the code today.

 

 

Thanks

sf dev.ax1640sf dev.ax1640
Hi i am working on encrypted field, but cannot display the values correctly. Can you provide the code

Thanks
ApexPreyApexPrey
Sorry, I haven't done any Force.com development for a long time, and I really don't remember the details of the encrypted field issues. At the time I had a very unique problem that had to do with accessing encrypted fields via JavaScript Remoting. Not sure if this is what you're referring to. In any case, I'm no longer a source for technical info about force.com development...
MandMMandM

Did anybody get an example of this working? Or have some insight on the concept?

MandMMandM

I found a workaround::

 

If you put the decrypted data into a url parameter before you make the getcontent() call, you can display the decrypted data

 

PageReference pdfPage = new ApexPages.StandardController(objPC).view();
pdfPage = page.wmcardiacreferral;
pdfPage.getParameters().put('id',objPC.ID);
pdfPage.getParameters().put('pfName',objPC.patient_first_name__c); <-- Here is where the parameter is passed to the URL
Blob pdfBlob;
pdfBlob = pdfPage.getContent();

 

The wmcardiacreferral VF page uses a controller:

 

public string pfName {get;set;} <-- declare the variable to be called by the VF page

 

public referralFormController(ApexPages.StandardController stdController) {

 

pfName = ApexPages.currentPage().getParameters().get('pfName'); <-- set the variable 

 

}

 

In the vfPage we access the variable to display --> {!pfName}

 

depending on how you are accessing the sObject, you may need add an inputHidden field

 

 <apex:inputHidden value="{!patient_case__c.patient_first_name__c}"/>