Using Promise for Apex Server-Side request in Lightning Component

In Lightning Components, each communication with Apex Server-Side is handled as a Javascript async request, and the callback you set is called after the server-side action is completed. A server-side action can return any JSON object, such as sObject or a map of name-value pairs. The followoing sample code shows how a server-call works in […]

read more

Bulk Approval Processing from List View in Salesforce

I have shared “Approval Processing with Apex in Salesforce” in previous post, and in this post, I’ll continue to share the way of bulk approval processing from Salesforce list view. The outline we need to do is as below : ・Add a custom button for list view ・Set List View Layout ・Add a Apex Class […]

read more

Approval Processing with Apex in Salesforce

An approval process is an automated process your organization can use to approve records in Salesforce. Usually we can request/approve an approval process through the standard approval process feature, but we can also do those things with Apex in some cases such as : request/approve from VF Page or from Custom Button. Here is Approval […]

read more

Salesforce ContentDocument sObject in Apex Unit Tests

ContentDocument object does not allow insert DML operation in Salesforce, but we can create it through the ContentVersion object, without ContentDocumentId, then a new version of ContentDocument will be created for us in SFDC, just like the sample code below :

read more

Salesforce CategoryNode sObject in Apex Unit Tests

In Salesforce,DML operation is not allowed on CategoryNode sObject,even in Unit Test. Although the 《Force.com Apex Code Developer’s Guide》 does not mention it clearly,that CategoryNode object can be accessed in Apex Tests, we have to prepare CategoryNode data first in Setup interface.by clicking Customize > Solution > Solution Categories. The following is the sample code […]

read more

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

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

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

A simple Salesforce Trigger framework

Well,this is another Salesforce Trigger framework but more simple. Usage AccountTriggerHandler.cls AccountTrigger.trigger In normal case. Stop and resume sObject Trigger in APEX code Stop and resume a TriggerHandler in APEX code SourceCode Download from Github That is all, Enjoy it!

read more