This is my code. I think the e.nameValues is the issue. But I don't know how to fix it. I read the documentation. This nameValues object does exist and it should pass the values in an array. I also tested the Info array using a hard coded value. It works. But when I added the afterFormSubmit function. This script created errors above. Your help is much appreciated. Thank you!
---------------------------------------------------------------
function afterFormSubmit(e) {
const info=e.nameValues;
createPDF(info);
}
function createPDF(info) {
// const info={
// 'Today Date': ['2021/01/14'],
// 'Check-in Date': ['2021/01/14'],
// 'Check-out Date': ['2021/01/15']
// };
const pdfFolder=DriveApp.getFolderById("11i2mJ0L4V1XjSXmuep5VBN9LCtme1yI2");
const tempFolder=DriveApp.getFolderById("1j_rVmne5ISwzyEl9La6pLMF5GYW97ytn");
const templateDoc=DriveApp.getFileById("1rgsPepR8m10_9dEti9pi4QNfZPziPrQr4p6seDsnZSw");
const newTempFile=templateDoc.makeCopy(tempFolder);
const openDoc=DocumentApp.openById(newTempFile.getId());
const body=openDoc.getBody();
body.replaceText("{todayDate}",info['Today Date'][0]);
body.replaceText("{checkInDate}",info['Check-in Date'][0]);
body.replaceText("{checkOutDate}",info['Check-out Date'][0]);
openDoc.saveAndClose();
const blobPDF=newTempFile.getAs(MimeType.PDF);
// const PDFFile=pdfFolder.createFile(blobPDF).setName("Regisration-"+info['Guest 1 First Name'][0]+"-"+info['Guest 1 Last Name'][0]+"-"+info['Check-In Date'][0]);
const PDFFile=pdfFolder.createFile(blobPDF).setName("Regisration-"+info['Check-in Date']);
tempFolder.removeFile(newTempFile);
}