Class FormTriggerBuilder

  • FormTriggerBuilder is used to build form triggers.

  • Thecreate() method creates and returns a new trigger.

  • TheonFormSubmit() method specifies a trigger that fires when a form response is submitted.

  • TheonOpen() method specifies a trigger that fires when the form's edit view is opened.

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.

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

Return

FormTriggerBuilder — thisFormTriggerBuilder, for chaining


onOpen()

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

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

Return

FormTriggerBuilder — ThisFormTriggerBuilder, for chaining.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-11 UTC.