Meaningful Error Messages #24

Having just managed to discover the cause of a particular error message, I thought I’d share the solution with the community.

Once in while you come across error messages that point you in absolutely no direction at all. Most recently I’ve been receiving ‘Failed validation: ApexPage‘. Thinking that I might get something more meaningful from the in-browser IDE I dumped my code there and got this little gem

ErrorError: common.request.servlet.PageDispatcher$Hack404
ErrorError: null
Considering that I was working with a several hundred line file, this made me less than happy. At times like these I whip out that old faithful tool of developer’s everywhere, theĀ binary search algorithm.

Read more

VisualForce Component Ids & Javascript

I have retired this approach in favour of a much neater solution that can be found here.

Salesforce used in conjunction with JavaScript and Ajax can be pretty smashing. I’ve used a number of JavaScript libraries that make you want to high-five yourself when implemented. There can(and probably will) be some frustration while you bend a library and make it fit within the Salesforce framework, although Ron Hess has some pretty sweet examples for you to pore over.

One simple frustration I’ve come across is that of retrieving elements by Id. Salesforce has an intelligent scheme in place which ensures that HTML elements don’t have duplicate Ids and therefore conform to W3C standards.

Read more

Datatable VS Repeat

A long long time ago, in an office not far away I pondered the need for so much variety in the VisualForce ‘structural’ component library. I mean, dataTables, pageBlockTables, outputPanels, panelGrids, repeats, panelBars.. jeez Louise. And when would I use them all? How should I combine them? If I type google in google will I break the Internet? Okay, I didn’t really ponder the last one, everyone knows that’s true.

Nowadays I’d like to think I have a feel for what to use, and when. More specifically I’m going to dig into when to use dataTables over repeats, and vice versa(The only real difference I can find between pageBlockTable and dataTable is that dataTable has a cool onhover JS handler that highlights the currently onhovered row, so I’m totally going to ignore pageBlockTable. Speak to the hand pageBlockTable, because the face ain’t listening).

Read more

Salesforce, Bugs & You

Bugs. Bleh. As far as I know Salesforce doesn’t maintain a list of ‘Known Issues’ and sadly this can mean hours poring over code, trying to find where you went wrong, and eventually finding that it wasn’t your code at all. Of course it wasn’t, because you are perfect. Go on give yourself a hug.

To this end I’ll post bugs as I find them and if you feel like contributing, mail me a few of your own. Some buggy areas are quite obscure, so I’ll start with a common one, the infamous ‘Null Param passed by a CommandButton’. Dun dun duh.

Read more

Visualforce & Dynamic CSS

When I started working on the Force.com platform CSS was an area that made me sad a bit. Deep down. Overriding the Salesforce CSS is a nightmare and I would recommend you don’t begin the dark and daunting journey down that path. Rather start afresh, you’ll thank me later.

That said, dealing with CSS on the platform can still be a timeconsuming task. Especially if you are incorporting images into your pages using CSS. My initial process was something similar to this:

  1. Create a stylesheet and some styles. Hopefully you’ve done a good job because you have no way of quick-previewing the result.
  2. Include said stylesheet and all referenced images in a zip file. Take care to preserve the directory structure so that you can reference all stylesheet and image files correctly.
  3. Upload the zip file as a static resource.
  4. Create references to the stylesheet in appropriate pages.
  5. View page. Realise you need to move one of your outputPanels 3px right. Be sad. Deep down. Goto 1.

Read more

Dynamic Custom Labels

I know what you’re thinking, ‘this is cRAzY talk’. But do not doubt my friend, Salesforce has a very powerful translation framework.

Besides being able to change the language used by the Salesforce standard areas with the flick of a picklist, you can include translatable Custom Labels in most of your custom application. To do this you will need to request that the ‘Translation Workbench’ feature be enable for you Salesforce development environment, after which you will find new areas in your ‘Setup’ menu.

Post enablement you can then create a Custom Labels and include them where necessary within your code. This can be done within a VisualForce page like so

Read more

VisualForce Tag Cloud Component

Tag clouds are nothing new on the interwebs, but there is some debate as to which sort of implementation is best. In this debate I prefer the simplest solution [insert further debate as to the definition of ‘simplest’ here] which I propose to be a simple unordered HTML list with some CSS styling.

Furthermore, wouldn’t it be great if this solution were dynamic, thus enabling you to create tag clouds specific to a particular application context?. Rhetorical question, of course it would be. To this end I’ve created a component that utilises a controller, mostly dynamic in nature.

To start with, let’s have a look at the component code

Read more

An Introduction

Salesforce.com is an ever increasing presence on the interweb. They’re leaders in a market that promises to be the next generation of software development, that of cloud computing. Google, Amazon and Mosso are some other names that have realised the current and potential power of developing and/or hosting in the cloud and it’s an area that I’m glad to be involved in from so early on.

Although this tech is not new, it is still young, and I’ve started this blog as a way to contribute to the growing community of Cloud Computing developers. The teething problems are still quite apparent in this industry, and as someone who’s been heavily involved in the technology for some time, I’m starting to see how problematic certain aspects of this type dev are(although the benefits far outweigh the drawbacks).

Read more