CODE Error Message

44 views
Skip to first unread message

Andrew Dixon

unread,
May 12, 2023, 3:19:12 AM5/12/23
to Google Apps Script Community
Google Script confuses me.....

I have a script that runs perfectly in the EDITOR... it deletes the calendar entries, shows no errors and shows COMPLETED.

But if I run it via the WEB APP I get the following error

               ReferenceError: parameter is not defined (line 6, file "Code")

and shows FAILED......BUT ..it still deletes the calendar entries as it should. 


So I need a little help.

The CODE and CALENDAR.GS files are below

CODE.GS

const responseDelimiter = 'RESPONSEDELIMITER';

const timeout = 10000;

// This is the output folder on the Cloud

let baseFolder = DriveApp.getFolderById('My Folder Address Here');

function doGet(event) {

  let service = event.parameter.service;

  return this[service + 'DoGet'](event);

}

function displayThis(){

  Logger.log(this);

}

function displayThis(){

  Logger.log(this);

}

 

CALENDAR.GS

var calendarId = "My Calendar ID He...@group.calendar.google.com";

  var calendar = CalendarApp.getOwnedCalendarById(calendarId);

  var events = calendar.getEvents(new Date("30 June, 2022"), new Date("01 July, 2023"));

function deleteAllDayEventDoGet() {

  // get the active spreadsheet

  function myFunction(event) {

  console.log("Script started running.");

  // Wait for 5 seconds

  Utilities.sleep(5000);

  console.log("Script completed.");

}

}

  for (var i = 0; i < events.length; i++) {

    var event = events[i];

    event.deleteEvent();

}

 Thank you in advance

Andrew Apell

unread,
Jun 4, 2024, 9:30:34 AMJun 4
to Google Apps Script Community
Does "service" or "parameter" always exist as a property? If not, use optional chaining.
Reply all
Reply to author
Forward
0 new messages