在Form中创建一个ItemResponse [英] create an ItemResponse in Form

查看:94
本文介绍了在Form中创建一个ItemResponse的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将代码的自动回复发送给我的一个表单。我可以打开它并发送空的回复(我创建了FormResponse并将其提交为空)。



现在我想在提交之前填写itemResponses。我尝试使用

  FormResponse.withItemResponse(itemResponse)

https://developers.google.com/apps-script/reference/forms/form-response?hl=es-ES#withItemResponse(ItemResponse)
但我无法找到一种方法来创建ItemResponse参数来填充我的FormResponse。
我搜索了整个文档,我知道必须有一种方法,但我根本找不到它。

  var form = FormApp.getActiveForm(); 
var response = form.createResponse();
var itemResponse = ????????????;
response.withItemResponse(itemResponse);
response.submit();

任何提示?感谢您!

解决方案

发现它!
因为Google搜索 itemresponse不会抛出任何东西,我终于在Google搜索了GAS文档站点的itemresponse ...


创建ItemResponse的唯一方法来自特定的Item类型对象。例如:

  var itemResponse = TextItem.createResponse('my text'); 

https://developers.google.com/apps-script/reference/forms/text-item#createResponse(String)


I'm trying to send an automatic response from code to a form of mine. I can open it and send empty responses (I create a FormResponse and submit it empty).

Now I want to fill the itemResponses prior to submit. I'm trying to use

FormResponse.withItemResponse(itemResponse)

https://developers.google.com/apps-script/reference/forms/form-response?hl=es-ES#withItemResponse(ItemResponse) but I can't find a way to create the ItemResponse argument to fill my FormResponse. I searched the whole documentation, I know there must be a way, but I simply can't find it.

var form = FormApp.getActiveForm();
var response = form.createResponse();
var itemResponse = ????????????;
response.withItemResponse(itemResponse);
response.submit();

Any hint? Thank you!

解决方案

Found it!

Because Google search "itemresponse" throw me nothing, I finally searched itemresponse in Google for the GAS documentation site...

The only way to create an ItemResponse is from the specific Item typed object. For example:

var itemResponse = TextItem.createResponse('my text');

https://developers.google.com/apps-script/reference/forms/text-item#createResponse(String)

这篇关于在Form中创建一个ItemResponse的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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