Masking Input on VisualForce Pages

I am a developer and (at least as often) a (l)user. UI and UX design are important from both perspectives, and it’s important to bear this in mind whilst creating any application. What is this waffle all about? There are some platforms, based in yonder cloud that could tweak the tiniest of features, and make the lives of their users (and administrators) 1 x shed-load better. Until they do that, we’re gonna have to do it ourselves.

Let’s get specific. Typically, validation error messages provided by Apex and VisualForce are only apparent after form is submitted ( or when we’re on the last page of a 39-page wizard ). Of course some cases require that it be this way, but for other cases it’s like my (very) old professor used to say, “Jus’ don’t let em make the mistake in the first place boy *tongue-click*”. Heeding Prof. Swart’s advice, let’s see how we can easily do this.

Read more

Salesforce: Polymorphism driven by Apex class inheritance

Polywhatsthatnow? Polymorphism ” is the ability of one type, A, to appear as and be used like another type, B.

It is a facet of OOP and can best be described using the good ol’ example of the ‘Shape’ class problem (thanks Java!). Let’s suppose we’d like to create an application that drew a number of shapes on a page. At the time of analysis we know that we want to immediately support circles, but to future-proof our application we need to support the drawing of any shapes. Being Pretty Darn Good Developers(tm) we realise we should create a Shape class that has a single method used to draw itself, and any specific shapes should be derived from this class, and override that method. Make sense? Didn’t think so.

Read more

Howto: Communicate between template- and inner- pages.

This post is as much about me asking a question as it is about providing a solution, so don’t let me down community. I got your back, but you’ve got to scratch mine too.. A little to the left, ah yeah, that’s it. The topics in question here are page templates, their controllers, and the pages (and the controllers) that use the template. But first let’s start with what I’ve discovered.

I like using page templates, they make my life easier. If I’m creating a site I probably want to have some consistency of navigation, page header, search etc. across all my web pages. So let’s assume I have the following setup:

1. A VisualForce page I use as a template.

2. A controller for this page that handles navigation, searching etc.

3. Several ‘inner’ VisualForce pages that use this template.

4. A controller for each of these pages.

Read more

DML currently not allowed

This almost belongs in my sarcastically titled, “Meaningful Error Messages ..” series, but as it has traceable causes, I thought I’d write something up on its most frequent causesĀ (I meant to write this up a few months ago, but it slipped my mind (find it in your heart to forgive an ol’ developer) and now I think it’s time the world knew).

‘DML currently not allowed’, what could that mean? Well it means that DML isn’t allowed. And that it’s not allowed right now, but with the slight promise that given time, it will be allowed. Often in the past, hoping against hope, I kept on pressing that button/link/onclick-area, but the cloud never changed its mind. With a sigh I constructed the Google search query and began trundling through the results.

Read more

Flickr + jQuery + Salesforce = Awesome^5 [Part 2]

Okay software developing enthusiasts, I’m back from Paris (you didn’t know I was gone did ya?), I’m a year older and culturally, I’m richer (well I’d like to think so at least). It’s time to complete our two-part series on integrating disparate systems using  the most-excellent combination of web services, jQuery and the Force.com platform. In part 1 we learnt how to connect to a third-party endpoint (Flickr in our case), and consume their SOAP-based web services. Now we’re going to jazz it all up with our spiffy jQuery gallery carousel. Let’s have another look at where we want to be at the end of this all,

GalleryView 2.0 Integration

Read more

Flickr + jQuery + Salesforce = Awesome^5 [Part 1]

Being a mathematician, equations like those in the title usually make me wanna poke someone in the eye.. but in this case it’s just too true to not use. My aim over the next two posts is to provide you with the knowledge to,

  1. Consume web services from within the Force.com platform(without WSDLs).
  2. Use web services(we’ll be using the SOAP-based variety), or other agents, as data sources for integration with JavaScript, and in particular, jQuery.

I will cover point 1 in this post, and then bring it all together in a second post which will cover point 2. It’s gonna be a rocky ride, but I’m sure all you cowboys/girls/others can handle it. Just so we know where we want to end up, our final product will look something like this,

Read more

Multiple forms in a single VisualForce page

I thought I’d post a quick tip I picked up from Jill Wetzler, Visualforce(and, I suspect JavaScript) Legend. When developing pages that contain more than a single area that could be submitted(not necessarily refreshed) I would usually wrap these areas with forms. Jill pointed out that I’d been a silly bloke(my words, not hers) and could use a single form and wrap each area with an<apex:actionregion> tag.

Read more

SOSL, friend or foe?

As requested by Chris Peterson I’d like to dig a bit more into SOSL. This is as much a lesson for me as anyone else, and I’d be ecstatic if anyone out there could offer a bit more depth on the topic. SOSL (or sossel) is Salesforce’s search language, and in my experiences definitely has it’s advantages(which are significant in the CRM) and limitations(which may stem from me/us just not knowing how to use it properly). First let’s make sure you have the standard docs memorised.

Basic doc on SOSL within Apex code

API doc, thorough on syntax although might not have some common examples.

Doc for dynamic SOSL

Right, now that we have those committed to memory we can delve into what I think are the advantages and disadvantages of SOSL..

Read more

OOP in the Salesforce Cloud – ReCaptcha Revisited

Can I get a OOP OOP?! That’s right folks, OOP is alive and well on the Force.com platform, and over the past few months I’ve had some pretty thrilling experiences implementing projects using those trusted sidekicks Encapsulation, Polymorphism and trusty ol’ Abstraction. There is some pretty sweet documentation on the subject, but I thought I’d demo something supercool I learnt by combining two articles from the Force.com wiki.

Read more