As we know all languages has thier quirks and odd/unexpected/undefined behaviours. Gary Bernhardt pointed out some of those in his lighting talk.
As i’m currently tided up to SlaveforceSalesforce and in my opinion there is lots things to fix and improve. I’ll put here some of inconsistances in code and it’s behaviour. If you know more of them, give me a shout.
“Lest talk about salesforce” :)
PageReference comparision
While wrtiting tests for software we assume a lot of things. Most basic assumption is that objects are properly compared. In test i belive object should be compared by it’s content and it works most of the time. But when you want to assert equality of PageReference the magic happens :)
In my opinion this should execute nicely and let the test pass but hey, it’s Salesforce :)
Of course there is workaround. But it should work out of the box.
StandardSetController pagination
Let’s say we have component for StandardSetController pagination. Component’s page is simple and it’s similar to standard pagination used by Salesforce. Controller for this component contains few methods to traverse it’s records collection. Also it has additional feature to handle collection with edited objects.
Looks legit, right? And it works flawlessly except one case. When you save controller traversal methods doesn’t works as excepted. What i noticed and as i understand is that after save methos is executed set controller reset it’s current page number to 1 and you can view only 1 and 2 pages.
Why? I do not know.
How to deal with this? I’ve got workaround solution. I had to get one. You have to switch page manually. And this woks like a charm.
And here it is component itself. Neat, right? :)
Input field focus
Have you ever wondered how Salesforce is focusing input fields? Or with displayed popup page jumped to first input field out of the sudden? Yeah, that was VisualForce page focusing on input field. Of course you can disable this behaviour with little trick. Actually it’s a onelined JavaScript.
Yes. JavaScript. Why? I don’t know.
And you’re done. No more autofocus on this VF page.
This is not the end
This post is going to be published ‘rolling release’ manner. So there will be updates for sure. Keep in touch :)