Wedid:BCI Data Modelling in Salesforce

Challenges

Data intelligence and leads coming from BCI are the core sales opportunity in the business of our chemical construction site service customer.

These leads are externally provisioned through CSV files and it needs to be tracked in Salesforce so that it can blend into other business data. The convergence of these data will help the customer form a powerful source of report in the forecast and finance area.

The current challenge is these data are residing out of Salesforce system.

Solution:

  1. Review through the files given by BCI and review the data that need to be in Salesforce
  2. Identified the core objects – Project, Firm, Contact, Contact Role
  3. Work through a model to connect these objects as part of Standard/Custom object and link with Opportunity to track any finance information
Related Objects Account, Contact, Project (CO), Opportunity, Opportunity Contact Role
Components Data modelling
Complexity Low

Salesforce: Check Null/Empty Value of A Field

In Salesforce, it is very common that we build formula field, validation rule or workflow rules to act on the data of a field and sometimes we would like to validate on an empty value. In Salesforce formula editor, there are two functions: ISBLANK() and ISNULL(). The question here is, which is the correct one that we should use?

ISNULL()

This is an old function that works with most of the field types except Text, Text Area and Long Text. (reference)

ISBLANK()

This is a new function that Salesforce introduce to support the empty field validation on Text fields. It also works with other field types. According to Salesforce documentation, it is recommended to use this function instead. (reference)

Please note that if you are referencing a formula field with the option “Treat blank fields as zeroes”, the formula field will give value zero and won’t be considered as null.

Above is how you can validate an empty field in formula editor. How can we achieve the same in Apex?

Text Fields

There are a few options to validate empty text fields in Apex:

Use String.isBlank() method. This will return true if the text field is empty.
Compare the text field to an empty string, e.g, Account.Name == ”. You shouldn’t use NULL as text field in Salesforce is never considered NULL. Note that String variable can still be considered NULL.

Checkbox Fields

This can be compared by using TRUE or FALSE. This is because an unchecked checkbox field is considered as FALSE instead of NULL.

Other Fields

You should compare the field value to a NULL.