Visualforce関連

Zip attachments only with Apex in Salesforce

Before this post (about 2 years ago), I’d shared a post that is about how to zip attachments with JSZip and Apex in Salesforce, and recently I found a more simple way to do that thing, which is only using an Apex library named “Zippex” ( view on Github). Here is the outline of my […]

read more

Using HTML tag(e.g. line break) in Custom Label

Custom Label is a really useful feature in Salesforce, not only can be edited after deployed, but also can be used for making an app multilingual with Translation Workbench. If you want to use HTML tag with it on Visualforce Page, e.g. <br /> tag, the only thing you need to do is using an […]

read more

Display Address type field on Visualforce Page

Address is an especial type of fields in Salesforce, which is a structured compound data type, that we can’t use it directly on Visualforce page. And there will occure a compile error like “Unsupported type: common.api.soap.wsdl.Address used in expression: record.BillingAddress”, if we did that. As the code sample below, we need to use fields BillingStreet, […]

read more

Determine odd or even row in apex:repeat loop

Sometimes we need determine if the index is odd or even in tag, such as showing table row in alternate color. There’s a simple soluton as below code: Enjoy it!

read more

Calculate the difference between two DateTimes in Salesforce

In Formula Calculate the second difference between two DateTimes. In Visualforce Page Calculate the second difference between two DateTimes. In Apex ※A “Date/time arithmetic expressions must use Integer, Decimal or Double arguments” error will be occurred, when we subtract between two DateTimes directly like Formula.

read more

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

Salesforce reRender dose not work with rendered attribute

Salesforce reRender will not work, if we’re going to hide reRender target with rendered attribute of itself, as the following sample code. In my opinion, reRender will reset the target DOM Node but not replace it after AJAX request completed,that means we can reset it’s childNodes even it’s html attributes, but cannot remove it.So there […]

read more

Salesforce RemoteAction and webService

In Salesforce,we can make asynchronous requests from Visualforce Page,via RemoteAction or webService. I will share you the usage of RemoteAction and webService In this post. RemoteAction Using RemoteAction(JavaScript Remoting) allows us to call methods in Apex controllers and get a callback with return data from JavaScript. The @RemoteAction methods in Apex must be static and […]

read more