Class FormTriggerBuilder

FormTriggerBuilder

A builder for form triggers.

Methods

MethodReturn typeBrief description
create()TriggerCreates and returns the new trigger.
onFormSubmit()FormTriggerBuilderSpecifies a trigger that will fire when a response is submitted to the form.
onOpen()FormTriggerBuilderSpecifies a trigger that will fire when the form's edit view is opened.

Detailed documentation

create()

Creates and returns the new trigger.

Return

Trigger — the new trigger

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/script.scriptapp

onFormSubmit()

Specifies a trigger that will fire when a response is submitted to the form.

var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
ScriptApp.newTrigger('myFunction')
    .forForm(form)
    .onFormSubmit()
    .create();

Return

FormTriggerBuilder — this FormTriggerBuilder, for chaining

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/script.scriptapp

onOpen()

Specifies a trigger that will fire when the form's edit view is opened.

var form = FormApp.getActiveForm();
ScriptApp.newTrigger('myFunction')
    .forForm(form)
    .onOpen()
    .create();

Return

FormTriggerBuilder — this FormTriggerBuilder, for chaining

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/script.scriptapp

发送以下问题的反馈:

此网页
Apps Script
Apps Script
需要帮助?请访问我们的支持页面