A bug caused by Decimal without SetScale

Let’s see the following Apex Script first. In fact the Apex Script will throw an AssertException. “System.AssertException: Assertion Failed: Expected: 0E-32%, Actual: 0%”. So we’d better round the Decimal before we convert it to String.Like the following Apex Script.

read more

Use subquery in SOQL

Salesforce allows us to use subquery in SOQL. The following soql is a sample, shows how to filter out Parent Records that don’t have a related child with subquery. And subquery also works in Related(Lookup) Objects, e.g. Be attention that the object name have to be Child Relationship Name when subquery SELECT as a field, […]

read more

Display DateTime with TimeZone in Visualforce Page

TimeZone 3

In Salesforce,Date and Date/Time values are stored in GMT,and a GMT time will be outputed when we use apex:outputText tag. e.g. Result ※Time Zone : (GMT+09:00) Japan Standard Time (Asia/Tokyo) As we know,we can not determine a user’s time zone in a formula,but there has two ways to fix this with Apex,maybe more. 1.Get User […]

read more

Use Salesforce Mini Page Layout in Visualforce Page


Mini Page Layout is a nice feature of Salesforce,it can be maintained for every parent object in master-detail or lookup relationship in order to display additional record information without jumping to its detail page. Enable Mini Page Layout First,navigate to Customize > User Interface and check “Enable Hover Details” which can enable Mini Page Layout […]

read more