Update Google calendar event with automation bot.

Hi everyone,

Scenario:

When new appointment created in Appointment table create a Google calendar event as well.

Adding new event with automation no problem works perfect.

If appointment changed need to update the related Google calendar event as well with automation ( manually We can do that's no problem but need with Automation).

Any solution?

0 1 198
1 REPLY 1

Hello, you will have to adjust your need. I didn't write the code, I found it on github
function updateEvent(title) {
            if (title) {  
                var eventToUpdate = gapi.client.calendar.events.get({
                    "calendarId"'primary'
                    "eventId"title
                });

                eventToUpdate.description = $("#update-description").val();
                eventToUpdate.start = {
                    'dateTime': (new Date()).toISOString(), //2023-02-22 08h00m00s
                };
                eventToUpdate.end = {
                    'dateTime': (new Date(), 2).toISOString(), //2017-04-22 09h00m00s
                };

                var request = gapi.client.calendar.events.patch({
                    'calendarId''primary',
                    'eventId':title,
                    'resource'eventToUpdate
                });

                request.execute(function(event) {
                    console.log('Event updated: ' + event.htmlLink);

                    //Action. Maybe refresh your events list ? 🙂
                });
            }
        }


function addHoursToDate(startingDatehours) {
  var newDate = new Date(startingDate.getTime());
  newDate.setHours(newDate.getHours() + hours);
  return newDate;
}

 

Top Labels in this Space