Zoho FSM | Create an event in Google Calendar for a Service Appointment

Create an event in Google Calendar for a Service Appointment

Use case: Whenever a service appointment is created in FSM, create an event in Google Calendar.
 
Follow the steps below to implement this use case:

Step 1: Create a connection for Google Calendar 

To use the Google Calendar APIs via the invokeURL task in the custom function, you need to create a connection for Google Calendar. To do so:
  1. Navigate to Setup > Developer Space > Connections and click Create Connection.



  2. Under the Default Services tab, select Google Calendar.



  3. Do the following and click Create And Connect.
    - Enter the Connection Name as Google Calendar. The Connection Link Name will be automatically populated.
    - Disable Use Credentials Of Login User. If this is disabled, the connection will utilize the credentials of the connection owner.
    - Select all the Scopes.



  4. Click Connect in the authentication page.



  5. Click Connect in the Authorization page.



  6. Choose an account.



  7. Click Allow in the Authorization page.



  8. In the custom function, where the Google Calendar API is used via the invokeURL task, use this Connection Link Name.


Step 2: Create a custom function  

Create an event in Google Calendar from a service appointment.
  1. Navigate to Setup > Automation > Functions and click Create Function.



  2. Enter the following details and click Save:
    1. Function Name: CreateEventInGoogleCalendar
    2. Module: Service Appointments
    3. In the Deluge Script Editor, enter the following script:

      service_appointment_id = service_appointment.get("id");
      resp = zoho.fsm.getRecordById("Service_Appointments",service_appointment_id);
      resp_data = resp.get("data").toMap();
      Scheduled_End_Date_Time = resp_data.get("Scheduled_End_Date_Time");
      Scheduled_Start_Date_Time = resp_data.get("Scheduled_Start_Date_Time");
      Summary = resp_data.get("Summary") + " (Zoho FSM)";
      description = "https://fsm.zoho.com/home#/tab/Service_Appointments/" + service_appointment_id;
      Service_Address_Map = resp_data.get("Service_Address").toMap();
      street = Service_Address_Map.get("Service_Street_1");
      city = Service_Address_Map.get("Service_City");
      state = Service_Address_Map.get("Service_State");
      zip = Service_Address_Map.get("Service_Zip_Code");
      country = Service_Address_Map.get("Service_Country");
      location = street + ", " + city + ", " + state + " " + zip + ", " + country;
      Contact_Id = resp_data.get("Contact").toMap().get("id");
      Contact_resp = zoho.fsm.getRecordById("Contacts",Contact_Id);
      Contact_resp_data = Contact_resp.get("data").toMap();
      con_email = Contact_resp_data.get("Email");
      emailMap = Map();
      emailMap.put("email",con_email);
      emailList = list();
      emailList.add(emailMap);
      startMap = Map();
      startMap.put("dateTime",Scheduled_Start_Date_Time);
      endMap = Map();
      endMap.put("dateTime",Scheduled_End_Date_Time);
      bodyMap = Map();
      bodyMap.put("end",endMap);
      bodyMap.put("start",startMap);
      bodyMap.put("description",description);
      bodyMap.put("eventType","default");
      bodyMap.put("summary",Summary);
      bodyMap.put("attendees",emailList);
      bodyMap.put("location",location);
      response = invokeurl
      [
       url :"https://www.googleapis.com/calendar/v3/calendars/{calendarId}/events"
       type :POST
       parameters:bodyMap.toString()
       connection:"googlecalendar"
      ];
      info response;
In the above custom function, replace {calendarId} with the actual value. You can find the calendarId in the Settings page of your calendar. Refer Google Calendar's API documentation for details.
 

Step 3: Create a workflow rule  

Whenever a service appointment is created in FSM, create an event in Google Calendar.
  1. Navigate to Setup > Automation > Workflow Rules and click Create Workflow.
  2. Enter the following details, then click Next:
    1. Module: Service Appointments
    2. Rule Name: Create Event in Google Calendar
    3. Description: Create an event in Google Calendar when a new service appointment is created



  3. Select the rule trigger as Created and click Next.



  4. Select the rule criteria as To all Service Appointments. Click Next.



  5. Click +Action and select Function.



  6. Select Existing Functions and click Next.



  7. Select the function created in the previous step.



  8. Click Save.

Testing the use case

Create a Service Appointment. An event will be created in your calendar.
 

 

    Zoho CRM Training Programs

    Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

    Zoho CRM Training
      Redefine the way you work
      with Zoho Workplace

        Zoho DataPrep Personalized Demo

        If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

        Zoho CRM Training

          Create, share, and deliver

          beautiful slides from anywhere.

          Get Started Now


            Zoho Sign now offers specialized one-on-one training for both administrators and developers.

            BOOK A SESSION








                                    You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.




                                        Manage your brands on social media

                                          Zoho Desk Resources

                                          • Desk Community Learning Series


                                          • Digest


                                          • Functions


                                          • Meetups


                                          • Kbase


                                          • Resources


                                          • Glossary


                                          • Desk Marketplace


                                          • MVP Corner


                                          • Word of the Day


                                            Zoho Marketing Automation

                                              Zoho Sheet Resources

                                               

                                                  Zoho Forms Resources


                                                    Secure your business
                                                    communication with Zoho Mail


                                                    Mail on the move with
                                                    Zoho Mail mobile application

                                                      Stay on top of your schedule
                                                      at all times


                                                      Carry your calendar with you
                                                      Anytime, anywhere




                                                            Zoho Sign Resources

                                                              Sign, Paperless!

                                                              Sign and send business documents on the go!

                                                              Get Started Now




                                                                      Zoho TeamInbox Resources



                                                                              Zoho DataPrep Resources



                                                                                Zoho DataPrep Demo

                                                                                Get a personalized demo or POC

                                                                                REGISTER NOW


                                                                                  Design. Discuss. Deliver.

                                                                                  Create visually engaging stories with Zoho Show.

                                                                                  Get Started Now









                                                                                                      • Related Articles

                                                                                                      • Create an event in Zoho Calendar for a Service Appointment

                                                                                                        Use Case: Whenever a service appointment is dispatched in Zoho FSM, create an event in Zoho Calendar. Step 1: Create a custom function Step 2: Create a workflow rule Step 1: Create a custom function Add a custom function that will create an event in ...
                                                                                                      • Service Appointments

                                                                                                        Is there a provision to reschedule appointments? Can we reschedule an appointment for past and future dates? Yes. In the appointment details overlay, you have the option to reschedule the appointment. You can change the dates, field agent, and more. ...
                                                                                                      • Error creating an appointment - The chosen service resource is assigned to another appointment

                                                                                                        Error Encountered Reason One or more of the Service Resources (field agent or crew) you want to assign to the service appointment are already assigned to another service appointment. Resolution You can try one of the following options: From the ...
                                                                                                      • Email Customers the Attachments in Service Appointment Notes

                                                                                                        Usecase: On service appointment completion, email the attachments in service appointment notes to the customer. Follow the steps below to implement this usecase: Step 1: Create a connection for Zoho FSM Step 2: Create a custom function Step 3: Create ...
                                                                                                      • Copy Notes from Work Order to Service Appointment

                                                                                                        Use case: When a Service Appointment is created, copy the Notes from its parent Work Order. Follow the steps below to implement this use case: Step 1: Create a connection for Zoho FSM Step 2: Create a custom function Step 3: Create a workflow rule ...
                                                                                                        Wherever you are is as good as
                                                                                                        your workplace

                                                                                                          Resources

                                                                                                          Videos

                                                                                                          Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.



                                                                                                          eBooks

                                                                                                          Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.



                                                                                                          Webinars

                                                                                                          Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                                                                                          CRM Tips

                                                                                                          Make the most of Zoho CRM with these useful tips.



                                                                                                            Zoho Show Resources