Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

101
Views
Elemento de fecha de llenado previo

He estado tratando de encontrar el método correcto para completar previamente el campo de fecha de inicio en mis Formularios de Google con la fecha y hora actuales, pero no pude lograrlo.

Creo que createResponse(hour, minute) sería el mejor método, sin embargo, no tengo ni idea de dónde incluirlo en mi secuencia de comandos:

 function book1() { var form = FormApp.getActiveForm(); var responses = form.getResponses(); var len = responses.length; var last = len - 1; var items = responses[last].getItemResponses(); ////// var current= items[2].createResponse(10, 00); var email = responses[last].getRespondentEmail(); var equipment = items[1].getResponse(); var datestart = items[2].getResponse(); var dateend = items[3].getResponse(); var cal = CalendarApp.getCalendarsByName(equipment)[0]; Logger.log('current '+current); Logger.log(datestart); Logger.log(dateend); var start = new Date(datestart); var end = new Date(dateend); Logger.log('start '+start); Logger.log('end '+end); var allEvents = CalendarApp.getCalendarsByName(equipment)[0].getEvents(start, end);//Returns an array of events if (allEvents.length < 1) { var event = cal.createEvent(equipment, start, end) .addGuest(email); MailApp.sendEmail({ to: email, subject: "Equipment " +equipment+ " booking confirmed", htmlBody: "Equipment " +equipment+ " available, please return it by " +dateend+ " and scan the QR code when returning it.", }); } else { var blob = HtmlService.createHtmlOutputFromFile("calendariframe").getBlob(); MailApp.sendEmail({ to: email, subject: "Equipment " +equipment+ " not available", htmlBody: blob.getDataAsString(), }); }; }

En mi último intento, encontré ese error; TypeError: items[2].createResponse is not a function

¿Sabrías cómo hacerlo funcionar?

Sabiendo que el prellenado de fecha y hora solo simplifica el proceso de los usuarios del formulario, pero que en algunos casos no utilizarán la fecha y hora actual como hora de inicio de la reserva.

¡Muchas gracias por adelantado!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!