I'm new to Javascript and Stackoverflow. We Recently migrated from Microsoft Exchange to Gmail and I'm trying to automate some of the team processes to make them more user friendly and manageable. One of those is Time-Off requests. With the help the community here I was able to write a Google Apps Script that updates the shared team calendar with Time-Off requests. For a new request I create a calendar event colored yellow, as free so it doesn't block time in the calendar, and with no reminders (which is how I want it). Once the request is approved I update the event color to green, from free to busy and add a reminder. Everything works great except reminders. I tried many approaches but nothing works... Here's the relevant code. Any help is much appreciated!! PS. I'm using the Advanced Calendar Services
if ((requestStatus == "Approved") || (eventStatus == "confirmed")) {
var eventReminders = "{method: email, minutes: 900}";
} else {
var eventReminders = null; //No reminders
}
//var eventReminders = setEventReminders(requestStatus); //set calendar reminders
// Compose event details based on the data read from the relevant row in the sheet
var newEvent = {
summary: 'Time-Off (' + requestStatus + ') ' + requestorName,
description: eventDescription,
colorId: colorE,
transparency: eventTransparency,
reminders: {
useDefault: false,
overrides: [
eventReminders
]
},
start: {
date : startDate //use date instead of dateTime to create full day event so the event will pin on the top of the calendar
},
end: {
date : endDate
},
attendees: [
{email: requestorEmail}
]
};
//Create the event in the calendar
updateCalendar (eventAction, newEvent, rowE, eventRequestID);
}