Formatting Salesforce OutputText

Quite recently I came across an interesting forum post by XactiumBen that mentioned some awesomesauce abilities of params in outputTexts. I’ve written an article detailing the basics of this functionality before, and thought I’d document these advanced capabilities too. For anyone interested you can read Part 1 here.

Now I’m sure some of you thought that simply being able to use dynamic custom labels was pretty smashing in it’s own right, but you ain’t seen nothing yet. Imagine a world where you could not only use dynamic custom labels, but were also able to use decision structures in those labels. That’s the world we live in buddy!

Read more

Meaningful Error Messages #94

This one is a hoot, Error: java.sql.SQLException: ORA-00001: unique constraint (CORE.AKAPEX_CLASS) violated ORA-06512: at “SNEEZY.CAPEX”, line 505 ORA-06512: at line 1 : {call cApex.update_class(?,?,?,?,?,?,?,?,?,?,?,?)})} Sneezy.Capex, what a cute name. The number of question marks in the error message scares me a bit so I may take an early lunch and try to forget about it. Solution pending.

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

the sharing model cannot be updated through the api

Now I’m sure there’s a reason for this but it makes me sad a bit. Especially when working with a team of developers. Recently I found myself in the following situation,

My team and I had been building a Force.com application and were interested in implementing an UAC model. We had setup the UAC model on one of the Orgs using profiles, roles and sharing rules(we had some issues here too) and then attempted to commit these changes into our SVN repository. Happy that things were going so well, each developer checked out the code and BHAM! we were no longer able to deploy object definitions. [Slow pan to me on my knees screaming to the heavens. A thunderbolt, then a thunderclap overhead]

Read more

Handling System.QueryException

When attempting to fetch a single record from the database it is easy to run into the above exception. I’ve seen two schools of thought in dealing with this issue – mostly in the forums – and have been hoping to find a more official standpoint.

Read more

Unit Test Data Consistency

I’m sure every Apex developer has had their Developer Org data interfere with their unit testing. Or perhaps you have coded unit tests that function perfectly within your Developer Org but when deployed to another Org fail because of a different, partial or empty database.

Of course as a developer this type on inconsistency within your work environment is extremely counter-productive. Initially I developed a methodology that did the job but wasn’t nearly as concise as I would have liked. More recently however I’ve developed a technical solution that is universal as well as quick to implement.

Read more

How to avoid Governor Limits [Part 1 of N]

This topic is waaaay too big to cover in one post, so for now I’m going to concentrate on avoiding this particular exception: ‘Too many SOQL queries’. I will also touch on the ‘Too many DML rows’ exception, and expand on it’s solutions in another post. Bulkifying your triggers is another topic I will cover at some later date, but the methodologies mentioned here should go some way towards helping you avoid some of the Governor Limits there too.

Read more