The client is a Canada based design and architecture company which provides building designs, floor plans, house plans and construction drawings. The client specializes in designing renovations and new builds. The client caters to approximately 100-150 customers monthly.
- The client wants Google Calendar Salesforce Integration to sync Salesforce’s Event standard object with Google Calendar in such a way that when an Event is created in Salesforce for a User, an Event with all the details should be created in the respective User’s Google Calendar also. The client wanted this functionality for many different Users.
- Events should not get duplicated and when a User cancels an Event in Salesforce, it should be deleted from his/her Google Calendar.
- When an Event is updated or moved from one User to another, this all should be reflected in the Google Calendar instantly.
As per our analysis of the given requirements, we created an Apex batch class to fetch the tokens and credentials from the Users’ Google Calendar. Another batch was created to refresh the tokens. This batch was scheduled to run on a regular basis. We also created an Apex trigger to manage the CRUD functionalities performed on the Salesforce’s Event and reflect them on the User’s Google Calendar.
- The Google Calendar API is a REST API which can be accessed through explicit HTTP calls or via Google Client Libraries. Whenever an Event is created in Salesforce under a given User, a callout to Google calendar API is made. We used OAuth 2.0 authentication to make the callout, which basically consisted of Users’ credentials and description/details of the Events under respective Users. The response received in JSON is parsed and then mapped to Salesforce’s Event to reflect the newly created Google Calendar Event’s Id. The Event records are created both in the Salesforce as well as in the User’s Google Calendar.
- In order to avoid creation of duplicate Events at User’s end i.e in User’s Google Calendar, we added a check in Salesforce which makes a callout to delete the older Event. The Events are created and updated using unique ids which in turn helps in managing the unique records and it prevents the creation of duplicate Events.
- Whenever the Event is assigned to a new User in Salesforce, the trigger is fired and the changes are made. The Calendar Event is deleted from the previous User’s Calendar and is added to the new User’s Calendar. Any modification which is made in the Event record in Salesforce is also reflected on the related User’s Calendar.
- A fully automated system of Google Calendar Salesforce integration with Salesforce events was set up.
- This reduced the client’s manual labour and helped in effortless tracking of Events and their details.
- This helped in providing a better user experience to the client.
Google Calendar Event: