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
Del_SantosDel_Santos 

Displaying Opportunity field value in VF page rendered as PDF

Hi,

 

How can I display opportunity field value in VF page rendered as pdf. It only displays blank value..

Please help. Many Thanks in advance..

 

<apex:page showHeader="False" standardController="Opportunity"  sidebar="false" renderAs="pdf" >

    <apex:form >
          <apex:outputText value="{!Opportunity.Street_1__c}"/>
      </apex:form>

</apex:page>

Best Answer chosen by Admin (Salesforce Developers) 
Imran MohammedImran Mohammed

The link should be something like this

https://cs4.salesforce.com/apex/quotation?id=opportunityIDVal

This way salesforce will pick the details of that particular opportuntiy and render on the page

All Answers

Imran MohammedImran Mohammed

Does the URL that navigates to this VF page has value for id as query string parameter?

Also, i suggest you use apex:outputField tag instead.

 

One more thing, remove renderAs attribute and check if values are printed.

Del_SantosDel_Santos

Hi Imran,

 

None.  It is a custom opportunity link configured only as below.

 

https://cs4.salesforce.com/apex/quotation

 

Hope you can help on this..Thanks for a quick response..

 

Del

 

Imran MohammedImran Mohammed

The link should be something like this

https://cs4.salesforce.com/apex/quotation?id=opportunityIDVal

This way salesforce will pick the details of that particular opportuntiy and render on the page

This was selected as the best answer
Del_SantosDel_Santos

https://cs4.salesforce.com/apex/quotation?id={!Opportunity.Id}

 

Big thanks Imran! appreciate your help..

Del_SantosDel_Santos

Hi Imran,

 

Sorry, one more thing, how can I display values in plain text? some  values with data type as LOOKUP are displaying as link in the pdf page.

 

Thanks!

 

Del

Imran MohammedImran Mohammed

For example if there is a lookup field named Sample__c, then to display the name rather than link, you should do it as

<apex:outputText value='{!Sample__r.name}'/>

Del_SantosDel_Santos

Working.. Thanks Imran.. :)