javascript – How to use Script to modify Google Form question that contains conditions, and add other option?

javascript – How to use Script to modify Google Form question that contains conditions, and add other option?

Solution

1) Array of Choices must be consistent

You cannot use the setChoiceValues(MY_VALUES) because the question you are updating is expecting a Choice instances of the type (value, navigationType).

From the documentation:

Choices that use page navigation cannot be combined in the same item with choices that do not use page navigation.

2) Update the existing question with .setChoices()

You can update the question you need using the same code you are using to create a new question. Be sure to build a consistent array of Choices containing a navigationType parameter.

3) Adding the Other option

The Other option can only be programmatically set on choices without navigationType parameters. This happens to be a bug: currently, you can only create this option from the UI for choices that contain navigationType parameters.

If the Other option is already set with the proper navigationType you can use the setChoices(choices) to update an existing question.

Reference

createChoice(value, navigationType)

javascript – How to use Script to modify Google Form question that contains conditions, and add other option?

Leave a Reply

Your email address will not be published.