Hi,
I'm trying to write a script that sends a custom email to the person who submitted it. The content of the email depends on the responses of the user, so I'm trying to get them.
When I fetch the responses from the form, I get an error. So, I simplified my code for some simple debugging:
function onFormSubmit(e) {
MailApp.sendEmail({to: my_email_address, subject: 'Log', body: JSON.stringify(e)
}
When I submit the form, I do get an email (so at least the trigger works properly), but it contains this:
{"authMode":{},"response":{},"source":{},"triggerUid":"1758093"}
The response object is empty, even though I filled in the form.
When I try to debug the whole Form, with this:
function onFormSubmit(e) {
var form = FormApp.getActiveForm()
MailApp.sendEmail({to: my_email_address, subject: 'Log', body: JSON.stringify(form)
}
The log email contains only an empty object:
I thought it may have been due to a lack of authorisations for the forms API, so I explicitly added
https://www.googleapis.com/auth/forms to the oauthScopes in my manifest. The OAuth popup did include the "form modification" notice, which I authorised, but the log emails remain the same.
Any idea why that is? How can I get the data from the submitted form?
Thanks.
Thomas