ashtonfei / google-apps-script-projects

My Google Apps Script projects shared on YouTube.
https://youtube.com/ashtonfei/
103 stars 50 forks source link

GAS-080 Google Form with UID in Confirmation | TypeError: Cannot read property 'range' of undefined with run(e) AND _onFormSubmit Event #1

Closed testLPCP closed 2 years ago

testLPCP commented 2 years ago

TypeError: Cannot read property 'range' of undefined run @ Code.gs:56 _onFormSubmit @ Code.gs:65

in short issue with run(e) AND _onFormSubmit Event

New Form Created Google Form with UID in Confirmation

On Form submission the records are saved to GoogleSheet (downloaded & copied from your site) Google Form with UID in Confirmation

We checked and found that the Google Form copies and customized as above after verifying to the SENd FORM with the selected above link still linked with Your Template Form and not our linked form.

However the data is posted to our customized linked Spreadsheet, with new sheet (Response 2 | 3 | 4 different try) within the spreadsheet and not to the (newly created sheet) of the this.ss, but no UID is added to the post. Now the option to configure the post the records to such sheet from linking is by default send to your sheet of your sheet Response template and not newly created by app to Response 2 ...

How can we change the post from this.ss (Response) to this.ss (Response 2) where the post is submitted, but the UID is not automated. Need to resolve the two Response sheet conflicting 'this.ss' of posting of records onSubmitEvent, so that the submission is posted either of the logical SpreadSheet to store & retrieve the data

Forwarded the both sheet link above in shared with public access for time being, and please to fix the deployed project not working.

https://docs.google.com/forms/d/1Gn4Ud3uzjbf9jigGBIXwUEvAerQaELHyFhX3CfCWJVE/edit#question=226269182&field=1849531307 https://docs.google.com/spreadsheets/d/1PX7SPLwbl7rtVkTMXUFC6inae7A-mPij4wehgP9z_I4/edit#gid=1575888123

ashtonfei commented 2 years ago

The event (e) object in the function can't only be assigned when the function is triggered by the form submission event. You can't run the function manually, or the event is undefined and you'll see the "XXX of undefined error".

And I tested your form, it's working now. image

image

When the function is executed by the trigger or by yourself manually. image

pyisoemin commented 7 months ago

Hello, Mr. Ashtonfei Could you please update code request to you, I would like to show the "UID-XXXXX" (e.g. "UID-00001") in email notification Subject? Thanks