Issue with setting form response destination (possibly an issue with getID() function)


NOTE: This issue has been brought to the attention of google dev's and they are apparently looking into solving this. There is no solution yet, please see here if this issue affects you too!


I have been working with a small project for a while in google script, I ran my script and received the "Failed to set response destination. Verify the destination ID and try again." error. This occured in a section of my code where various forms are generated each with a corresponding response spreadsheet, the error triggers on the first .setDestination() call:

responseSheet =  SpreadsheetApp.create('ConflictRespData for ' + activeRef.refereePi);
moveToFolder(DocsList.getFileById(responseSheet.getId()), conflictFolder);
Logger.log(responseSheet.getId());

conflForm = FormApp.create('Conflict Declerations for ' + activeRef.refereePi);
moveToFolder(DocsList.getFileById(conflForm.getId()), conflictFolder);
conflForm.setDescription(FORM_DESCRIPTION)
         .setConfirmationMessage(CONFIRMATION_MESSAGE)
         .setAllowResponseEdits(false)
         .setShowLinkToRespondAgain(false)
conflForm.setDestination(FormApp.DestinationType.SPREADSHEET, responseSheet.getId());

my code was working fine the last time I used it 2 days ago and running it today with no editing of anything I am now receiving this error. This leads me to believe this is an error on google's side, not in my own syntax.

I used the Logger to print the .getId() of the responseSheet after it was created and noticed that this string does not match the one seen in the address bar when I navigate to the spreadsheet through my google Drive, however pasting this Id in place of the actual id takes me to the spreadsheet.. I was under the impression that Id's must be unique.

I created a new script which is (essentially) an exact copy of the sample script on the Class Form page in the GAS documentation to support my suspicion that this is a google-side issue:

function myFunction() {
  var form = FormApp.openById('1ib3j66ogj3NgozVDeYxhNdqm6PaajUhN3dk24BXcd7s');
  var ss = SpreadsheetApp.create('Spreadsheet Name');

  // Update form properties via chaining.
  form.setTitle('Form Name')
     .setDescription('Description of form')
     .setConfirmationMessage('Thanks for responding!')
     .setAllowResponseEdits(true)
     .setAcceptingResponses(false);

 // Update the form's response destination.
 form.setDestination(FormApp.DestinationType.SPREADSHEET, ss.getId());
}

And yes in fact I still receive the same error message, and as well the Id of the spreadsheet when printed to the log does not match the Id in the browser navigation bar.

I would appreciate some insight as to the nature of this issue, or if there is something I am doing wrong here (although the exact same code was working before so I'm inclined to think not). If you can offer any help that would be great, I can't progress further without dealing with this issue.

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.