debugging - Debuggin function wrapped by triggers - Google Scripts
问题描述
that's my first time here so I am sorry if I will not follow StackOverflow guidelines to the line.
These days I had to create a pipeline for data collected by a Google Survey to a Google Sheet. The issue is that I am not able to debug in any way the function I wrote which should be triggered on-event formSubmit. The function is the following:
function notifyTeam(event) { // should triggered on formSubmit event
var db = getDB() // custom function to connect to datasheet -> works fine
var dt = new Date()
var email = event.responses.getItemResponses()[0] // -> returns error due to event is undefined
var sap_code = event.responses.getItemResponses()[0] // -> returns error due to event is undefined
I would like to know why on Earth the event parameter is undefined while I exactly followed Google Documentation.
Thanks so much for your help in advance.
解决方案
事件中的字段会有所不同,具体取决于“提交表单”触发器是否与表单或电子表格相关联。如果您的脚本绑定到电子表格,则需要使用event.namedValues
而不是event.responses
.
请参阅事件对象文档。
推荐阅读
- windows - 错误:无法使用字符串条件执行 CURL 获取请求
- magento - 访问产品选项商店查看标题
- c - 这行代码“#define LIBINJECTION_SQLI_TOKEN_SIZE sizeof(((stoken_t*)(0))->val)”是做什么的?
- beautifulsoup - 从表格的行和列中查找文本
- node.js - 使用 multer 和 gcloud 上传文件时未设置目标
- typescript - 如何声明一个只接受两个或零个参数的函数?
- python - 如何计算列表的最小不公平和
- swift - 尝试运行我的 ios 应用程序时,@rpath image not Found 错误
- flutter - Flutter - 添加 GridView 而不指定容器高度
- windows - 为什么 windows 不加载 WINUSB 驱动程序?