当Google任务标记为“已完成"时,如何触发Google脚本? [英] How to trigger Google Script when a Google Task is marked "completed"

查看:94
本文介绍了当Google任务标记为“已完成"时,如何触发Google脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Google Apps脚本允许脚本由各种事件触发;请参见此处.

Google Apps Script allows scripts to be triggered by a variety of events; see here.

我想在用户将任务标记为已完成(在Google任务中)时,在电子邮件(在Gmail中)上更新标签,但似乎没有触发条件.

I'd like to update the tag on an email (in Gmail) when the user marks a task completed (in Google Tasks) but there doesn't seem to be a trigger for this.

但是,Zapier能够以某种方式触发这些事件: 受支持的触发器

However, Zapier is able to trigger on these events somehow: supported triggers

因此看来此触发器必须存在.

So it seems like this trigger must exist.

除了使用Zapier之外,还有其他方法吗?

Is there a way to do this other than using Zapier?

很遗憾,Zapier(除了要花钱外)仅允许您向Gmail邮件中添加标签,而不能删除它们-因此,您不能(例如)将邮件标签从[未完成的任务]更改为[已完成的-任务].

Unfortunately Zapier (in addition to costing money) only allows you to add tags to Gmail messages, not remove them -- so one can't (for instance) change a message tag from [uncompleted-task] to [completed-task].

推荐答案

在撰写本文时(2018-05-15),Google Apps脚本不支持用于跟踪任务状态的触发器.

As of this writing (2018-05-15), Google Apps Script does not support a trigger to track a task's status.

我怀疑Zapier正在通过Task API轮询任务状态; IE.定期检查任务的状态属性,并在状态更改完成后触发事件.

I suspect that Zapier is polling the status of the task via the Task API; ie. periodically checking the status property of the task and firing an event once the status changes to complete.

您可以将Task API用作GAS中的高级服务(通过基于时间的触发器):

You can do the same (with time-based triggers) using the Task API as an Advanced Service in GAS:

  • https://developers.google.com/apps-script/advanced/tasks
  • https://developers.google.com/tasks/quickstart/apps-script

这篇关于当Google任务标记为“已完成"时,如何触发Google脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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