0

In our quote templates, some sites have very specific site terms where logos have to be displayed in the Quote. Currently, the Site terms are in a Text field (Site_Information__C) that gets pulled into the quote based on the SiteID.

I created a Rich Text Field for the new terms that require logos/jpg and inserted an image of the terms for a specific site. Now while some sites require jpgs and logos, other sites only have text in the field.

The challenge is:

Replace the text field “Site_Information” in the visual force page reference with the new rich text field and get the image to display OR the Rich text for sites where logos are not required.

Any help would be greatly appreciated. Thanks

This is the current code for the VF page that references the text field: enter image description here

    </apex:outputPanel> 
    <block font-size="9px" text-align="left" border-after-style="solid" border-after-width="2px" border-after-color="#000000">
    {!HTMLENCODE(siteById[site].**Site_Information__c**)}
    </block>
</block> 

Quote Template Screenshot

3
  • Would you be so kind as to excerpt your VF code not as a screen shot but as formatted code ?
    – cropredy
    Mar 16, 2022 at 16:37
  • </block> </apex:outputPanel> <block font-size="9px" text-align="left" border-after-style="solid" border-after-width="2px" border-after-color="#000000"> {!HTMLENCODE(siteById[site].Site_Information__c)} </block> </block> <apex:outputPanel layout="none" rendered="{!numberBySite[site] < sitesSize}"> <block break-after="page" /> </apex:outputPanel> </apex:repeat> </block> </apex:page> Mar 16, 2022 at 17:14
  • Thanks @cropredy Mar 16, 2022 at 17:15

1 Answer 1

0

Firstly, I'd add a checkbox to your site object that is titled something like "Logo Required" and check it for all sites that require a logo. This will make the VisualForce page code a little easier to manage, as you'll just tell it to render a block of either text or image based on the checkbox field instead of each specific site ID (which would require a manual update to the VF page any time that changes).

You could then update this code:

<block font-size="9px" text-align="left" border-after-style="solid" border-after-width="2px" border-after-color="#000000"> {!HTMLENCODE(siteById[site].Site_Information__c)} </block>

to something like this by adding a rendered tag to your block...

<block rendered="{!IF(Your_Object_Here.Logo_Required__c = false,true, false)}" font-size="9px" text-align="left" border-after-style="solid" border-after-width="2px" border-after-color="#000000"> {!HTMLENCODE(siteById[site].Site_Information__c)} </block>

Then a secondary block with the image inside and a similar rendered tag if the checkbox is true.

I have not officially tested this in our org, but please let me know if it works and mark the answer as correct if it does so it can help others. Happy SalesForcing!

2
  • Frish, very good approach I think but I can't get this to work - I think I'll find a developer that will do this for me before I break the code completely :) The current error after editing the code is "Create Apex method 'Quote_Template_Lines_Controller.getExcelitas_Site__c' " "and Create Apex property 'Quote_Template_Lines_Controller.Excelitas_Site__c'" The code was changed to this and I'm not sure the reference to the object "Excelitas_Site" is how it should be written. excelitas_Site__c.Use_term_Image__c (?) Mar 17, 2022 at 14:03
  • @ThomasLegrand - Based on what I see.. it seems like you may have used excelitas_Site__c.Use_term_Image__c where I have suggested Your_Object_Here.Logo_Required__c? If that is the case, you may need to write something similar to siteById[site].Use_term_Image__c there instead (as this is how it looks like they reference the object in the HTMLENCODE line). Mar 21, 2022 at 12:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .