I am trying to get a form submit to push a new issue to github. Here is the code, which I got from a gist which commenters seem to have been able to get working :
var ghToken = "MY_TOKEN";
function onFormSubmit(e) {
Logger.log(e)
var result = e.response.getItemResponses();
var testResult = result[1].getResponse();
var describeIssues = result[2].getResponse();
var issueScreenshot = result[3].getResponse();
var iosMail = result[4].getResponse();
var iosGmail = result[5].getResponse();
var iosOutlook = result[6].getResponse();
var androidGmail = result[7].getResponse();
var androidOutlook = result[8].getResponse();
var androidYahoo = result[9].getResponse();
var body = "## Status \n" +
"![warning]" + testResult +"\n" +
describeIssues +"\n" +
"______________________________________________________________________________________________________\n" +
issueScreenshot +"\n" +
"______________________________________________________________________________________________________\n" +
"## Test Results\n" +
"#### iOS\n" +
"| Mail | Outlook | Gmail\n" +
"| ------------- |:-------------:| :--------------:|\n" +
"| ![ios mail]"+iosMail+" | "+iosOutlook+" | "+iosGmail+"\n" +
"| **Interactive** | **Static** | **Static**\n"+
"| Interactive module off-center | Working - 2-column | Working 1-column\n"+
"#### Android = Samsung s8+\n" +
"| Gmail | Outlook | Yahoo! Mail\n" +
"| ------------- |:-------------:| :--------------:|\n" +
"| ![ios mail]"+iandroidGmail+" | "+androidOutlook+" | "+androidYahoo+"\n" +
"| **Interactive** | **Static** | **Static**\n"+
"| Interactive module off-center | Working - 2-column | Working 1-column\n";
var payload = {
"title": "Jon testing",
"body": body
};
var options = {
"method": "POST",
"contentType": "application/json",
"payload": JSON.stringify(payload)
};
var response = UrlFetchApp.fetch("https://api.github.com/repos/me/myRepo/issues?access_token="+ghToken, options);
}
This doesn't work however, when I run the script in the script editor or when I submit the form response I get TypeError: Cannot call method "getItemResponses" of undefined. (line 7, file "Code")
(by the way the triggers are set correctly to run on form submit using data stored in spreadheet, which I verified is being populated).
What am I doing wrong? Why is e
undefined?