Custom Components Not Rendering Properly

After much searching, I have finally figured out what was causing two frustrating issues I have run into several times and thought I would share it with everyone. Both issues involve creating a Custom Component that includes HTML.

If you use an iframe tag to reference an existing Visualforce page and do not include a certain switch in your URL, the component will not be rendered properly and instead of seeing the rendered Visualforce page, you will just see code in the area where your custom component should be (see top left home component of image below)

CustomComponentsShot1

To avoid this issue, you must add a parameter to the url attribute for your iframe tag. For example, the component titled, Case Count By Status was referencing a Visualforce page named CasesSidebar using an iframe tag. Instead of using src attribute that looks like the following:

src="/apex/CasesSidebar"

you will need to include a switch after the page name called isdtp. The src attribute should instead look like the following:

src="/apex/CasesSidebar?isdtp=lt"

A second issue involves how you enter the HTML for your custom component. If you are not careful about how the HTML is entered, your component will end up displaying the actual HTML code and not the rendered result. For example, if you were to add a Custom Component to the Home page by going to Setup | Customize | Home | Home Page Components and clicking New, you will be brought to a page that looks like the following:

CustomComponentsShot2

If you were to start entering HTML code into the editor below and THEN click Show HTML, you will have a problem when the component renders. Instead of displaying the rendered iframe, you will just see the iframe HTML where your component should be.CustomComponentsShot3

You MUST click the Show HTML checkbox BEFORE you type or paste any code into the editor area. I personally think this is a bug and it should not matter when you click the Show HTML checkbox, as long as you do so before clicking Save.

Perhaps Salesforce will fix this at some point in the future, but in the meantime, I wanted to post this and hopefully it will be found by someone encountering the same issue.

One comment

  1. […] In preparation for my upcoming Visualforce course on Lynda, I discovered something that I think may have a big impact on some people out there that are using iFrames to embed a Visualforce page in the Sidebar. I have seen this technique used by several people over the years to display data in the sidebar and up until just recently the only way to accomplish this was to create a Home Page Component that referenced a Visualforce page using an iFrame. It was kind of a kludgy thing (sort of a hack really, so I am not surprised to see it go). I even wrote about this in a post back in November. […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s