javascriptgoogle-apps-scripttriggersgoogle-forms

Getting started with google app script - can not retrieve form submission parameters


I am getting started with Google app script. I have a function that is triggered on form submit. Im am trying to access the properties inside e (formResponse class). I don't succed and I don't understand what I'm doing wrong.

Here is my script :

function formSubmitReply(e) {
    Logger.log(Utilities.jsonStringify(e));
    Logger.log(Utilities.jsonStringify(e.getTimestamp() ));
    Logger.log("success");
}

When I submit a form, this is the log :

[13-10-03 09:36:54:026 EDT] {"response":"FormResponse"}

And this is the error from the code transcript :

[13-10-03 09:36:54:061 EDT] Échec de l'exécution du script : TypeError: Cannot find function getTimestamp in object [object Object]. (line 9, file "Code") [durée totale d'exécution : 0.034 secondes]

Solution

  • According to the documentation: Understanding Events, you should try something like:

    ...
    Logger.log(Utilities.jsonStringify(e.response.getTimestamp()));
    ...