+ Start a Discussion
affuaffu 

Rendering image

Hi All,

 

I have a image in Visualforce pdf and i want it to display according to the field selection 

 

I have used the following code but it is not working

<apex:image url="{!$Resource.Image1}" rendered="{!Opportunity.Project_l__c='East Point'}" />

 

Project_I__c is a lookup field in Opportunity.

when i select this field as East Point it should show the image.

 

Please help me...

Thanks in advance.

Best Answer chosen by Admin (Salesforce Developers) 
PrakashbPrakashb

Hi,

 

Since its  a lookup field the Id will be available and not the Name.

 

Either you need to create a formula field to get the Name from the lookup or use the refrence string like Opportunity.Project_I__r.Name in your rendered condition.

All Answers

Naresh Krishna.ax1176Naresh Krishna.ax1176

can you try as below:

rendered="{!Opportunity.Project_l__c=='East Point'}"

affuaffu

Hi Naresh,

Thanks for replying

 

Sorry i dint understand the answer because i did the same above can u elaborate please..

 

Thanku.

Naresh Krishna.ax1176Naresh Krishna.ax1176

Please use double equals to :)

affuaffu

Yes Naresh I have double equalto but it is not working 

 

Can u please check the below condition is correct to display a image in PDF according to the field selection i.e., if Project_I__c=='East Point'.

 

<apex:image url="{!$Resource.Image1}" rendered="{!Opportunity.Project_l__c=='East Point'}"/>

 

 

PrakashbPrakashb

Hi,

 

Since its  a lookup field the Id will be available and not the Name.

 

Either you need to create a formula field to get the Name from the lookup or use the refrence string like Opportunity.Project_I__r.Name in your rendered condition.

This was selected as the best answer
affuaffu

thanku its working fine