Add Form Response to Form

How to add a Form response to the Form as a checkbox item.
Important notes:
* This can be done from the Form script editor itself, rather than the Sheet
* The trigger must be installed
* The steps are important: Get the correct item, cast it to the correct item type, get all current choices, push the new choice into the array, set the array as the choices for the item

The editable form cannot be shared.

Sheet (to copy from File then “Make a copy”):

function addNewChoice(e) {
let form = FormApp.openById(“1mBzV2NdfGMb82VCg_Dfx9pasl77bGuCkXTRc1Xya6FE”);
let check = form.getItems(FormApp.ItemType.CHECKBOX)[0].asCheckboxItem();
let inChoices = check.getChoices();
let outChoices = [];
for (let i in inChoices){
let newChoice = check.createChoice(e.values[3]);

Leave a Reply

Your email address will not be published. Required fields are marked *