JavaScript FormApp.openById() - No item with the given ID could be found

I have a Google Sheets trigger function that on form submit places submissions in sheets based on the value selected for one of my questions. I'm trying to test my function with "Test as an Add-On" feature, but when I submit a form, I receive an error within my onSubmit function with the error message No item with the given ID could be found, or you do not have permission to access it. (line 9, file "Code") from trigger formSubmit

This is the line of the error,

  var form = FormApp.openById(ss.getFormUrl());

which makes me think there is an authentication issue, but I'm not sure how to debug this further

Full code:

function onSubmit(e) {
  //Open Marketing - Discoveries and Changes - v1
  var sheet = e.range.getSheet();

  //Return Spreadsheet that contains this sheet
  var ss = sheet.getParent();

  //Open Marketing - Discoveries and Changes - v1
  var form = FormApp.openById(ss.getFormUrl());

  //Destination sheet based on "Location of Change"
  var destSheet = getSheet(ss, e.namedValue['Location of Change']);

  //Store response in destination sheet
  destSheet.appendRow(e.values);

  function getSheet( spreadsheet, sheetName, headings) {
    spreadsheet = SpreadsheetApp.getActive();
    var sheet = spreadsheet.getSheetByName(sheetName);
    if (sheet == null) {
      sheet = spreadsheet.insertSheet(sheetName);
      if (headings && headings.constructor === Array) {
        sheet.getRange(1,1,1, headings.length).setValues([headings]);
      }
    }
    return sheet;
  }

}
Answer:1

I'm having trouble trying to call a chain of asynchronous functions inside an array. When I call the function individually it works without any problem like in the example below: function ...

I'm having trouble trying to call a chain of asynchronous functions inside an array. When I call the function individually it works without any problem like in the example below: function ...

  1. calling async functions
  2. calling async functions javascript
  3. calling async function without await
  4. calling async function without await javascript
  5. calling async function without await c#
  6. calling async function c#
  7. calling async function python
  8. calling async function js
  9. calling async function nodejs
  10. calling async function in sync
  11. calling async function with await
  12. calling async function in constructor
  13. calling async function in sync c#
  14. calling async function in a loop
  15. calling async function vb.net
  16. calling asynchronous javascript functions in a sequential manner
  17. asynchronous calling method
  18. calling an asynchronous function within a for loop in javascript
  19. asynchronous calls synchronous functions

I am using this method in order to convert an Object to QueryString. QueryString is required for ajax send request. var objectToQueryString = function(a) { var prefix, s, add, name, r20, ...

I am using this method in order to convert an Object to QueryString. QueryString is required for ajax send request. var objectToQueryString = function(a) { var prefix, s, add, name, r20, ...

I have a loading object, with boolean values for each loading. My state looks like this: state: { loading: { itemA: false, itemB: false, itemC: false } } I want to update my state ...

I have a loading object, with boolean values for each loading. My state looks like this: state: { loading: { itemA: false, itemB: false, itemC: false } } I want to update my state ...

  1. updating nested object redux
  2. updating a nested object
  3. update nested object redux
  4. redux updating nested object
  5. update nested state redux

I create a new record, this record is successfully added to the database. That's good. But the problem is that it doesn't update the list of existing records - means the push function doesn't seems to ...

I create a new record, this record is successfully added to the database. That's good. But the problem is that it doesn't update the list of existing records - means the push function doesn't seems to ...

  1. angularjs does not update view
  2. angularjs does not work in ie
  3. angularjs does not show data
  4. angularjs does not contain
  5. angularjs doesn't work
  6. angularjs doesn't work in ie
  7. angularjs doesn't update view
  8. angularjs doesn't work in ie11
  9. angularjs doesnt load
  10. angularjs doesnt render
  11. angularjs doesnt update
  12. angularjs does not bind
  13. angularjs doesnt show data
  14. angularjs does not refresh
  15. angularjs doesnt start
  16. angularjs does not display
  17. angularjs does not recognize
  18. angularjs does not show
  19. angularjs does nothing
  20. angularjs watch doesn't fire