Line break character may be escaped by JS in VF Page

The line break character may be changed, if it is sent from Visualforce Page with Ajax(Such as apex:commandLink and apex:actionfunction). Let me show you a sample first. Sample Code Visualforce Page Apex Class Results Click [Compare By Submit] button, and the compare result is “true”. Then click [Compare By Ajax] link,we will find the compare […]

read more

Display DateTime with TimeZone in Visualforce Page

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

Refresh standard detail page from visualforce page in iframe

We may need to refresh the whole page but not only itself, when we use custom visualforce page in standard detail page,and it will not work well if we just use ‘location.href=”/”‘ by javascript. Let me show it in this post. The Problem 1.Prepare a custom object named Sales__c 2.Add an Apex Class “ExtendPageController” 2.Add […]

read more

Order of execution in Visualforce Page

In this post I’ll show you the order of execution when we views a Visualforce page. Apex Class Visualforce Page Result Log So,In conclusion: 1.Controller constructor 2.Page action 3.Controller property getter

read more

Date format and DateTime format

Date format in Apex 1.Use Date format method 2.Convert to String directly 3.Convert to DateTime DateTime format in Apex Date format in VF DateTime format in VF Date format in Formula DateTime format in Formula TZoffset is the difference between the user’s time zone and GMT。 When in Tokyo:TZoffset = “9/24” Reference : https://help.salesforce.com/help/pdfs/en/formula_date_time_tipsheet.pdf

read more

A way to make Thread Sleep in Apex

Sometimes we need make apex thread to sleep for a while, sush as testing if the soql with [For Update] works,and as we know the sfdc do not offer a method to sleep the thread. Then I thought it may work if I use the “while”, like the following code. Well, it looks not bad. […]

read more

How to access static resources from Apex, Visualforce and Custom Button

In Apex Normal file (with soql) Normal file (with PageReference.getContent) Zip file (with PageReference.getContent) ※Zip file can not be accessed by soql. In VF Normal file Zip file In Custom Button

read more

SFDC SObject Quick Panel – Quick access to Salesforce Standard Objects and Custom Objects

As a SFDC Developer,how do you open [Custom Object Setting] page, from [Setup] > [Create] > [Objects] > [Object Name] ? In fact,utilizing “sObject Quick Panel”,it could be more fast only need 1-Click. Screenshots Source code Download from Github That is all, Enjoy it!

read more

Salesforce Apex Zip Attachments With JSZip

Sometimes we need to zip Attachments or PDFs and download it at once in Salesforce development. As we know, Apex does not support Zip. it is conceivable that Zip files with other service such as Heroku or AWS, But in fact we can do this without any External Service, just Salesforce and JavaScript. This post […]

read more