Why do we still need to hack the Sidebar? Usecases – Workarounds – Alternatives

Since it seems to me, that a lot of people still need sidebar workarounds, I would be interested to learn about the use-cases, experienced challenges and (most important) possible strategies to avoid them by using different approaches. This is related to the methods discussed here: End of javascript sidebar workarounds?

In my experience there are a few extremely important and constantly repeating patterns, which to my knowledge are still very hard to be solved using more official techniques. I will also contribute my own top-N use-cases, which are mostly related to UX and UI concerns. You are very welcome to add your own scenarios as answers and add comments on how you would avoid a workaround. My dream would be to team-elaborate strong and repeatable solution-patterns for the most common use-cases.

Finally I would be interested in the experiences of all of you who participate in the Aura pilot, which hopefully could make this kind of workarounds obsolete.

Answer

Use Case: Embedded Visualforce Page on Layout

My top1 is to embed Visualforce Pages on standard layouts with a dynamic height of 100% of it’s content instead of a fixed height in px – which can not be anticipated in most cases at design-time. This happens quite often if you display dynamic data like tables or lists with variable content. Within the supported functionality, you end up either with huge empty screen-areas or scrollbars inside scrollbars or both and as an result with a very poor UX. This is a well-known limitation:
https://success.salesforce.com/ideaView?id=08730000000BpiMAAS but open for 6+ years.
Default Situation

Workaround

Injecting a addEventListener(“message”,…) into the top-frame and using postMessage() to request an iframe resize. Typically you will repeat postMessage() everytime when the iframe content changes or when the iframe will be resized (this happens because of it’s 100% width by default when users change the window size). The pattern is simple, only a few lines of code.

There is even a public listed App which is using this workaround: https://appexchange.salesforce.com/listingDetail?listingId=a0N30000004cEEyEAM – I didn’t check if it still works after the recent summer’14 enhancements to html-areas. But it’s an unmanaged package and reading End of javascript sidebar workarounds? you can easily fix it.

I remember the App as quite bulky. Since the pattern is very simple, a rebuild from scratch will take only a few lines of code.

Result

As expected, the resizing happens seamless and without issues. UX and Look&Feel is almost perfect. You can use this pattern for multiple Iframes on a single layout.
Adjusted Situation

Avoid Strategy

Override the the entire View by a Visualforce Page. This is a very radical and non-cooperative approach. Downsides:

  • loss of customizability
  • if you want to install 2 apps which both come with overrides for e.g. Opportunity, you can only use the vf-page provided by one.
  • you loose the Force.com Quick Access Menu

Attribution
Source : Link , Question Author : Uwe Heim , Answer Author : Community

Leave a Comment