设置表单响应目标存在问题(可能与getID()函数有关) [英] Issue with setting form response destination (possibly an issue with getID() function)

查看:71
本文介绍了设置表单响应目标存在问题(可能与getID()函数有关)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Google脚本中处理一个小型项目一段时间了,我运行了脚本并收到了无法设置响应目标.请验证目标ID,然后重试."错误.这发生在我的代码的一部分中,其中生成了各种形式,每种形式都有相应的响应电子表格,该错误在第一个.setDestination()调用时触发:

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());

我的代码在2天前的最后一次使用中运行良好,而今天却在不进行任何编辑的情况下运行,我现在收到此错误.这使我相信这是Google方面的错误,而不是我自己的语法.

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.

创建后,我使用Logger打印responseSheet的.getId(),并注意到该字符串与通过Google云端硬盘导航至电子表格时在地址栏中看到的字符串不匹配,但是将其粘贴了用ID代替实际ID会将我带到电子表格..我的印象是ID必须是唯一的.

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());
}

是的,实际上我仍然收到相同的错误消息,并且电子表格的ID在打印到日志时也与浏览器导航栏中的ID不匹配.

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.

推荐答案

此错误现已修复.我在这里添加此内容只是为了结束问题.

This bug is now fixed. I'm adding this here just to close the question.

查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆