Author: Enrico Murru

[Visualforce / Tip] Always add a tag

Always add <apex:pagemessages/> at the beginning of your VF page to see if there are errors in loading/submitting VF page. If something underneath the Visuarlfoce is wrong, you don’t see anything (no clear log at least)! I was using the automatic SOQL generation of the “Object__c” standard controller, and to do this I usually use […]

[Salesforce / Canvas] Set up a minimum Canvas App (Java style)

This new post is about setting up a Force.com Canvas App and doing beautiful things with it. It comes from an old challenge I won (see Cloudspokes.com blog post), evenif in that case I used Javascript to get the session infos. What is a Canvas App? In simple words it is a way to integrate […]

[APEX] Strange automatic casting error from String to ID

Developing some APEX for a customer, I saw this error: System.StringException: Invalid id: -1 I checked the code and it was something like this: if(aString == anSObject.Id){ … } So a String object cannot be compared to an ID type if the first is not an ID? I switched the members: if(anSObject.Id == aString ){ […]

[Java Play! / Heroku] Setup Java Play! + Heroku + Eclipse

I’m not a very good developer, I have to admit it. I always forget, if I don’t “play HTML” for a while, how to define a CSS style class, so you can imagine what kind of memory I have (the worst kind), and what kind of problems I have to set an environment to make […]

[VisualForce] Block Auto Focus on DatePicker

This little post is born to remember how to avoid auto focus on Visualforce page of a DatePicker field, in case it is the first “focusable” field in the page: //avoid autofocus on date pickers function setFocusOnLoad() {} This is something I have found online some weeks ago, but I can’t remember the original post. […]

[Salesforce / Visualforce] jQueryUI + Dialog + Postback

I wanna show you what happens if you do a postback inside a modal jQuery UI dialog. This is a problem I had some times ago making this challenge on Cloudspokes. We have a simple controller: public class MyController { public String value{get;set;} public void anAction() { if(value != null && value.length()>0) ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR ,’Variable […]

[Salesforce / Apex] POST Mutipart/form-data with HttpRequest

17/10/2014: the solution has been improved. Datails at the end of the post. Grandma says you cannot post a Mutipart/form-data using an HttpRequest in APEX? Well, if she says this now you can tell her this is no more true! All comes from a CloudSpokes challenge (here is the link)…at the time of starting the challenge […]