Logo preload
close Logo

Integrating with Google Calendar

January 25, 2019

One of the many things people love about Fulcrum is its extensibility. We’re proud to offer a tool that easily integrates with other applications and services to meet the needs of your specific workflow.

In this post, we’ll demonstrate how the Fulcrum Professional Services team wired up Fulcrum with Google Calendar to create, modify, and delete calendar events, allowing organizations to get an overview of their data collection activity schedule – including hyperlinks to directly open their Fulcrum records, either on the mobile or web apps.

Specifically, we’ll be leveraging Fulcrum’s webhooks to push events to a Google Apps Script endpoint, which will handle the events and perform the relevant actions to interact with Apps Script’s Calendar Service, to make the appropriate calendar changes.

Fulcrum App Setup

Fulcrum webhooks come with the Developer Pack, so you’ll need that to proceed. Next, you’ll want to create an app with some fields to capture and handle the calendar event: description, start date & time, stop date & time, and an additional field to store a Google Calendar Event ID.

Below is an example of the basic setup.

Fulcrum App design for calendar integration

Note: you will probably want to make the Google Calendar Event ID read only

We chose to leverage Calculation fields to generate Unix time directly within the app. Here are the formulas used for that:

var start = new Date($start_date.getFullYear(), $start_date.getMonth(), $start_date.getDate(), $start_time.slice(0, 2), $start_time.slice(3, 5), 0);
SETRESULT(start.getTime());

var stop = new Date($stop_date.getFullYear(), $stop_date.getMonth(), $stop_date.getDate(), $stop_time.slice(0, 2), $stop_time.slice(3, 5), 0);
SETRESULT(stop.getTime());

‍Google Apps Script Setup

In previous posts, we’ve introduced Google Apps Script (GAS) as well as walked through how to integrate Fulcrum with Drive, Google’s file storage service. Our guide on Building a Custom Email Notification System should outline the basics to get started with GAS, so be sure to review the information contained there as we won’t be going over it again in this post. The GAS script to achieve the functionality seen in this post can be found here.

After deploying your GAS web app/endpoint and setting up your Fulcrum webhook with the GAS URL that will be notified when a Fulcrum event occurs. This should hopefully be working for you.

If you have success with this integration or would like to share a similar project you’re doing with Fulcrum + other applications, feel free to share your story with us on Twitter (@fulcrumapp) or by email at support@fulcrumapp.com!