Class QuizFeedbackBuilder

  • QuizFeedbackBuilder is used to build Feedback objects and set common properties like display text.

  • It provides methods to add links, set text, build the feedback object, and create a copy.

  • The addLink method can include a display text for the link.

  • The build method finalizes the feedback object.

QuizFeedbackBuilder

The base FeedbackBuilder that contains setters for properties common to all feedback, such asdisplay text. Used to build Feedback objects.

// Open a form by ID and add a new list item.constform=FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');constitem=form.addListItem();item.setTitle('Do you prefer cats or dogs?');item.setChoices([item.createChoice('Dogs',true),item.createChoice('Cats',false),]);// Add feedback which will be shown for correct responses; ie "Dogs".item.setFeedbackForCorrect(FormApp.createFeedback().setText('Dogs rule, cats drool.').build(),);

Methods

MethodReturn typeBrief description
addLink(url)QuizFeedbackBuilderAdds a link to the feedback's supplemental material.
addLink(url, displayText)QuizFeedbackBuilderAdds a link to the feedback's supplemental material.
build()QuizFeedbackBuilds a Feedback of the corresponding type for this builder.
copy()QuizFeedbackBuilderReturns a copy of this builder.
setText(text)QuizFeedbackBuilderSets the feedback text.

Detailed documentation

addLink(url)

Adds a link to the feedback's supplemental material.

Parameters

NameTypeDescription
urlStringthe link to display under the display text

Return

QuizFeedbackBuilder — thisQuizFeedbackBuilder, for chaining


addLink(url, displayText)

Adds a link to the feedback's supplemental material.

Parameters

NameTypeDescription
urlStringthe link to display under the display text
displayTextStringthe text to display for the link

Return

QuizFeedbackBuilder — thisQuizFeedbackBuilder, for chaining


build()

Builds a Feedback of the corresponding type for this builder.

Return

QuizFeedbackQuizFeedback


copy()

Returns a copy of this builder.

Return

QuizFeedbackBuilderQuizFeedbackBuilder


setText(text)

Sets the feedback text.

Parameters

NameTypeDescription
textStringthe new text

Return

QuizFeedbackBuilder — thisQuizFeedbackBuilder, 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.