Google Apps Script – How to Create an Installable Trigger

google-apps-scriptgoogle-apps-script-triggersgoogle-forms

I've searched all over Google's documentation on this topic and I haven't been able to find a tutorial or article that explains how to do this. I completely understand how to create simple triggers in a project.

I'm trying to populate a ListItem in a Google Form with information that is based on the user using the form. My understanding is that a simple onOpen trigger will not be triggered by users other than the owner of the script, hence my need to use "installable triggers". Please correct me if I'm wrong.

How do you set up an installable onOpen trigger within a script project?

Best Answer

Direct answer.

To create an installable triggers, open Script Editor (Tools > Script Editor in Spreadsheets or Documents, or in "three dots" menu in Google Forms). Within it go to Edit > Current project's triggers. A pop-up window will appear, listing the current triggers (if any) and prompting you to create a new one.

"On open" in a form

The above will not help because what you are trying to do is impossible. For a form "on open" means the form is opened for editing. This is true for both simple and installable triggers. There is no trigger for "someone opened the form to fill it up. You cannot modify the contents of the form based on who opened it.

Other remarks

a simple onOpen trigger will not be triggered by users other than the owner of the script

This is incorrect. I use simple onOpen triggers to create custom menu items in shared spreadsheets, and they work for every user with access to the spreadsheet.