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.


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


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.