【发布时间】:2022-09-23 00:04:39
【问题描述】:
我正在尝试在 Airtable 中创建一个链接到按钮的脚本。过程如下:
- Airtable 中的按钮被按下
- 如果复选框字段\'Jira switch\'为假,则将其变为真
- 等待 2 秒,将字段重置为 false
这是我使用 setTimeout() 函数编写的脚本:
let table = base.getTable(\"XOS\"); //The name of the table you\'re in here let record = await input.recordAsync(\'Pick a record\', table); if (record) { if (record.getCellValue(\"Jira switch\")===false) { table.updateRecordAsync(record, {\'Jira switch\': true}); output.text(\'checkbox ticked\'); } const myTimeout = setTimeout(timeDelay, 2000); function timeDelay() table.updateRecordAsync(record, {\'Jira switch\': false}); output.text(\'2 second interval\'); }当我编写代码时,我收到一条错误消息\"找不到名称 setTimeout\".作为一种解决方案,它建议\"添加缺少的函数声明\'setTimeout\'\"
如何声明此函数以便它可以与我的代码一起运行?
标签: javascript airtable