Visualforce Field Help Text The help icon can be added to a Visualforce field within an apex:pageBlockSectionItem. Access the help text using the $ObjectType api. Put it in the helptext attribute of the apex:pageBlockSectionItem. {!$ObjectType.Account.Fields.Phone.InlineHelpText} Easy Hover Tooltip The following may help if you are not using the apex:pageBlockSectionItem. I’ve used this technique in the…
Read moreAuthor: daveh
Define and Initialize a Map, List, and Set in Apex
The syntax for defining a list, map, and set collection with initial values sometimes slips my mind. The lack of () throws me off, so this post is to help out my future self. List Definition public list MyList = new list {‘AAA’, ‘AAA’, ‘BBB’, ‘BBB’, ‘CCC’}; Set Definition public set MySet = new <set>{‘A’,…
Read moreGet the Salesforce Session ID
Visualforce {!$API.Session_ID} Documentation: $API Variable Methods Apex String SessId = Userinfo.getSessionID(); Salesforce Documentation: UserInfo Methods Note: The session ID generated in the Visualforce page will not be the same as Userinfo method.
Read moreSort a list of sObjects: quick and dirty -or- elegant
Quick and Dirty Here is a method that I’ve implemented to sort lists of objects by combinations of fields. I don’t claim that it is pretty, but it has worked for me. public static list SortTrf (list iMyObjList) { list SortStringList = new list(); list SortedObjList = new list(); map ObjMap = new map(); MyObj__c…
Read morePad Number with Leading Zeros
Left pad a number with leading zeroes Thanks to mauricekremer.dyndns.org for the concept and code. Below is my take on the function. public static String PadZeros(Integer Num, Integer Len) { String s = String.valueOf(Num); while (s.length() < Len) s = '0' + s; return s; }
Read more