我知道可安裝觸發器是作爲腳本的作者運行的。但是一些服務,如email service只能使用可安裝的觸發器。將簡單觸發器變量傳遞到可安裝觸發器
我需要使用簡單的觸發器來檢查當前用戶是否有權編輯特定範圍和可安裝觸發器來發送電子郵件。
我有這樣的代碼:
var MY_VARIABLE;
function onEdit() {
MY_VARIABLE = 'onEdit was here!'
}
function myOnEdit() {
// installable trigger
Browser.msgBox(MY_VARIABLE);
// send email, use email service
}
結果是undefined
。
,我願意有'onEdit was here!'
您可以讓onEdit更新腳本屬性,讓其他觸發器檢查每分鐘是否有更新,然後發送電子郵件。 (腳本屬性:https://developers.google.com/apps-script/reference/properties/properties-service) –