All posts by TIM

Salesforce: How to Setup Lightning Sync for Google (Beta)


To sync email from Gmail to Salesforce, use the Lightning for Gmail feature. If you require to sync events from Google Calendar to Salesforce, you will be required to setup Lightning Sync.

See steps below.

Setup Guide

This video will show the step by step to setup Lightning for Google –

Note: Make sure you are using Google Enterprise & you are the admin of the enterprise account.

5 Setup steps –

Lightning Sync for Google (Beta) –

What you need

The below links will need to be opened on your browser:

  1. Salesforce Setup
  2. Gmail Admin Console –
  3. Google API Console –


Prepare Google Account

Step 1: Enable Google API

  1. Go to Google API Console > Create new project. (You can call it Lightning Sync)
  2. Enable Calendar API & Contact API:-
    – Google App API > Calendar API > Enable
    – Google App API > Contact API > Enable
  3. Click on Credential on right panel
    – New Service Account
    – Service Account Name – Company Name
    – Role – Owner
    – Key Type – JSON
    Note: Keep the downloaded JSON file.
  4. Credential > Manage Service Account
    – Company Name > Edit
    – Enable Domain Y Delegation
    – Configure Consent Screen > Fill in anything relevant. Leave optional blank if unsure.

Step 2: Setup Google Admin Console

  1. Go to Gmail Admin Console
  2. Click More Control > Security > Show More > Advance Setting > Manage API Client Access
    – Client Name = Client ID (From Google API Service Account)
    – One or More API Scope =,, > Authorize


Enable Lightning Sync in SF

  1. Go to Salesforce Setup >Quick Find > Lightning Sync Setup > Enable
  2. On the Upload Your Google Private Key section > Click Update > Upload JSON file
    Note: Test connection using Connection Test: Fill in your user email. You will see success message once connected
  3. Setup sync setting
    – Go to Setup > Quick Find > Sync Configuration
    – Create New (You can name it Default)
    – Configure Sync setting on the Data Setting section
  4. Check sync Status
    – Go to Setup > Quick Find > Sync Status
    Note: You can see summary of sync records here

Install Lightning for Gmail extension

  1. Go to this link –
  2. Click Add To Chrome
  3. See this documentation for how to use –

Salesforce Lightning Experience: Creating Recurring Tasks

If you are wondering how you can create recurring tasks in Salesforce Lightning, here is how:

Before you can create recurring tasks, you or your Salesforce admin may need to check if the feature is enabled:

Enable Delete & View Series

  1. In Lightning, go to Setup > Edit Object and Fields > Object Manager > Task
  2. Under Page Layout section > Click into Task Layout
  3. Make sure that ‘Delete Series’ & ‘View Series’ is displaying under ‘Salesforce 1 and Lightning Experience Actions’

View & Delete series

Display Recurring Fields

  1. In Task Page Layout, make sure to display the following fields: Create Recurring Series of Tasks, Recurrence Interval and Repeat This Task.
    Recurrign fields

Once above is enabled, you will be able to create recurring tasks.

What is View & Delete Series?

View Series is the detail page of the task.
Delete Series allows you to delete the task and all the following recurring tasks.

Delete SeriesNote: In order to use Delete Series, you will need to first go to ‘View Series’. 

Wedid: Using Salesforce in a Residential Care Environment


The main business requirement for the aged care facility was streamlining all the information to a single point of data entry as well as providing transparent updates to the residents.  Optimal care of the resident is enhanced when all data is stored in a single system.

Data such as medical records, progressive monitoring and the sharing of social updates as well as picture sharing among family members accessible via mobile.

Ability to grow as the facility increased the number of residents. The ability to provide a secure data store with access restricted based on users and information type.


  1. Gather all data and understand the origin and process involved
  2. Design the data model and to ensure a single point of data but ensure that security will not be compromised
  3. Leverage Salesforce Customer Community to provide updates on the residents to family members

Related Objects Lead, Account (Person), Contact, Other Custom Objects
Components Data modelling, Customer Community, Visualforce Page, Apex Trigger
Complexity Medium

Salesforce: Lookup Filter for Different Record Type

Scenario: How to limit a lookup field to only show certain records based on record type. For example, account has 2 record type – HQ & Branch. Each branch will need to specify the HQ using the Parent Account field:

HQ (Parent Account)
Branch 1
Branch 2
Branch 3

Based on the example above, we need to apply below restriction:

  • A Branch account can not have another branch account as parent.
  • A HQ account can not have branch as parent acount.

Solution #1: Lookup filter (Recommended)

You can use lookup filter to limit the selection based on record type. For example:

Filter criteria:
  1. Account record type = Branch
  2. Parent account record type = HQ
  3. Account record type = HQ
  4. Parent account record type = HQ
Filter logic:
(1 AND 2) OR (3 AND 4)Note!: Make sure that filter type is set to Required to make sure that the lookup value MUST match criteria!

Solution #2: Validation

You can also choose to create a set of validation rule to stop user upon saving a record. For example:

AND(RecordType = Branch, NOT(ParentAccount.RecordType = HQ)),
AND(RecordType = HQ, NOT(ParentAccount.RecordType = HQ))

Both solution above will trigger on bulk insert/update. You will probably get below error when you try to assign parent account that doesnt fit the criteria:

  1. ERROR: Value does not exist or does not match filter criteria  OR
  2. The error message you set in the validation rule

Form Assembly: Email Notification


  1. How to setup email notification?
  2. How to customise it?
  3. If an attachment is submitted in a form, how to display the attachment in the email notification?

Question #1: How to setup email notification?

  1. Login to Form Assembly > Click on Form
  2. Go to the Notification tab on right panel
  3. Under ‘Your Notifications’ section, choose Enabled (text emai) to send text notification email or Enabled (HTML email) where the email content will be in HTML form.

Question #1: How to customise it?
If you would like to customise the email notification content, you can do so by selecting ‘Customized template’ under Email template selection after enabling email notification.

Note: You can play around with different aliases to display different information in email notification. For example, use %%RESPONSE%% to display all submitted data in the form. Do bear in mine that hidden fields will also be displayed in the email notification.

Question 3: If an attachment is submitted in a form, how to display the attachment in the email notification?
If your form allows attachment and the receipient would like to view the attachment in the email notification, you can do so by using below aliases:

  1. %%FILE_LIST%% = Displays URL link that directs to attachment record stored in Form Assembly. Login is required in order to view/download the file.
  2. %%UNPROTECTED_FILE_LIST%% = Automatically downloads file when the url link is clicked. Login is not required.

Salesforce: Migrating Middle Name

In the spring’15 release, Salesforce introduced Middle Name and Suffix under the Contact object to avoid confusion between two records with the same first name and last name. To turn on this feature, you will need to contact Salesforce support. Both fields also supports data import.

For further details, check out the release notes for Spring’15.

Problem: If you are trying to import data into middle name field but somehow the field is not showing in your data loader mapping list. What should you do?


  1. If you are using apex data loader, make sure that your data loader version is the latest. The field will not show in older version.
  2. Make sure that the field is available in Salesforce. If you are using Professional edition, make sure that it is displayed in the layout.
  3. If above method does not work, try using any 3rd party import tool. ie:


Salesforce: Disabling Feed-Based Layout

Salesforce allows us to create feed-based page layout on Leads, Account, Contact, Opportunity & custom objects. See this documentation for more information –

However, once feed-based page layout is enabled, you are no longer able to revert it back to the normal page layout view. However, You can try below workaround:


  1. Create a new page layout
  2. Choose existing page layout (the feed-based layout)
  3. Do not check the feed-based check box

Once new page layout is created, remember to assign the page layout to profiles & record types.

Distribution Engine App: Assignment Algorithm

Distribution Engine allows you to choose the types of algorithm matching. For example, assign owner based on certain criteria in the record.

Round Robin

Sequential assignment among the team member that ensures objects are assigned out fairly. For example:

Assignment / User User 1 User 2 User 3
Record #1 1  x  x
Record #2  x 2  x
Record #3  x  x 3
Record #4 4 x x
Record #5 x 5 x
Record #6 x x 6

Sequence used for the round robin will order by who was assigned to last. This ensures that the team members who have not been assigned to recently are first in line.

Round robin with sticky assignment

Sticky assignment assigns duplicated records to the same owner. For example, duplicated records with same email address will be assigned to the same owner.

Note!: Sticky assignment is case sensitive.

Round robin lookup owner

Match records in other objects and assign to the same owner. For example, Lead has the same company name as account name, assign to the same owner.

Note: This matching algorithm is NOT case sensitive.

Salesforce: Sending Email to Custom Email Address

Question: Imagine that you have a custom email field name – ‘Secondary Email Address’. When sending an email to a Contact, can you send it to the secondary email address instead of the Contact email address?

Answer: Yes, you can. When sending out an email, you should be able to choose whether if you would like to send it to the primary email address or any other email addresses. For example:

Second email

NOTE!: This feature is available for Contact & Person Account. It is not available for Account or Opportunity.

Salesforce: Restoring Deleted Records from Recycle Bin

Usually after a record is being deleted, it will be stored in the recycle bin for 15 days. These records are being recognised by a checkbox field called IsDeleted. When a record is being deleted, this checkbox will automatically be checked.

Question: Can we update the IsDeleted checkbox to True?

Aparently this checkbox is made READ ONLY. So how can we restore records from the recycle bin?

WARNING: You will not be able to restore any records if they are being HARD DELETED.

Method #1: Manual restore

If you only have a few data, suggest that you restore them manually. Simple go to Home -> Recycle Bin, select the records that you would like to restore and click on ‘Undlete’ button.

* Once records are restored, any child tied to these records will also be restored.

Method #2: Developer Console

You can try running a few lines of codes in the developer console. Depending on the scenario, you can program the code to restore based on different condition.

For example: Restore all Account where Isdeleted = TRUE and Created Date = TODAY().

Method #3: Re-importing deleted records

You can use Apex Data Loader to export all deleted data and re-import them. Apex Data Loader ‘Export All’ allows you to export ALL data including any soft deleted data (in recycle bin).

*This will not restore any child records as this method is as if you are re-importing all the data from scratch.*

Method #4: Workbench

You can also try Salesforce Workbench where it can query all deleted records and undelete them straight from Workbench.