Count large number of records (more than 50,000)

In a Salesforce org that has more than 50,000 records of an object, the following simple count() query will still hit the Salesforce governor limit: “System.LimitException: Too many query rows: 50001” Even though it seems that the count function does not need to traverse the whole Contact table, it still does, for specific reasons like …

Custom sidebar: Pop up a modal dialog with content from static resource

Salesforce org’s sidebar can be customized by HTML so is often used for placing small components like a table or some hyperlinks to external web pages. Static resources can be used to host any type of files and easily referenced by Visualforce pages and apex classes. So this brings the idea of writing web widgets …

Visualforce expression on null equality comparisons

It is so natural these days to use the following Visualforce code to control the displaying of something wrapped in a pageBlockSectionItem. Even though the syntax {! clazz != null} looks strange, it is easy to read once getting used to the convention that first exclamation point in the curly brackets means the expression starts …

Customization: Conditionally display a message on the standard detail page

Ever wonder dynamically displaying a warning or information message on an object’s detail page without affecting whatever layout is used? Here is a simple requirement: you have an object called MyObject. If you go to view any MyObject record that is created today, you will see an information message “Hello world!” at top of the …