Google is committed to advancing racial equity for Black communities. See how.

Card Service

Card Service

This service allows scripts to configure and build card and widget components and behaviors for a UI. The UI structures you build with this service are automatically available in both desktop and mobile devices, so you don't need to develop separate UIs for both.

Classes

NameBrief description
ActionAn action that enables interactivity within UI elements.
ActionResponseThe response object that may be returned from a callback function (e.g., a form response handler) to perform one or more actions on the client.
ActionResponseBuilderA builder for ActionResponse objects.
AuthorizationActionAn authorization action that will send the user to the AuthorizationUrl when clicked.
AuthorizationExceptionAn error that can be returned to trigger an authorization card to be shown to the user.
ButtonA base class for all buttons.
ButtonSetHolds a set of Button objects that are displayed in a row.
CalendarEventActionResponseRepresents a response that makes changes to the calendar event that the user is currently editing in reaction to an action taken in the UI, such as a button click.
CalendarEventActionResponseBuilderA builder for CalendarEventActionResponse objects.
CardA context card that represents a single view in the UI.
CardActionA clickable menu item that is added to the card header menu.
CardBuilderA builder for Card objects.
CardHeaderThe header of a Card.
CardSectionA card section holds groups of widgets and provides visual separation between them.
CardServiceCardService provides the ability to create generic cards used across different Google extensibility products, such as Gmail add-ons.
ComposeActionResponseThe response object that may be returned from a callback method for compose action in a Gmail add-on.
ComposeActionResponseBuilderA builder for ComposeActionResponse objects.
ComposedEmailTypeAn enum value that specifies whether the composed email is a standalone or reply draft.
ContentTypeAn enum value that specifies the content type of the content generated by a UpdateDraftActionResponse.
DatePickerAn input field that allows inputing a date.
DateTimePickerAn input field that allows users to input a date and time.
DecoratedTextA widget that displays text with optional decorations.
DisplayStyleAn enum that defines the display style of card.
DriveItemsSelectedActionResponseRepresents a response that makes changes to Drive while Drive items are selected and in reaction to an action taken in the UI, such as a button click.
DriveItemsSelectedActionResponseBuilderA builder for DriveItemsSelectedActionResponse objects.
EditorFileScopeActionResponseMakes changes to a Google Workspace Editor, such as Google Docs, Sheets, or Slides in reaction to an action taken in the UI.
EditorFileScopeActionResponseBuilderA builder for EditorFileScopeActionResponse objects.
FixedFooterThe fixed footer shown at the bottom of an add-on Card.
IconPredefined icons that can be used in various UI objects, such as ImageButton or KeyValue widgets.
ImageA widget that shows a single image.
ImageButtonA ImageButton with an image displayed on it.
ImageStyleAn enum that defines an image cropping style.
KeyValueA widget that displays one or more "keys" around a text "value".
LoadIndicatorAn enum type that specifies the type of loading or progress indicator to display while an Action is being processed.
NavigationA helper object that controls card navigation.
NotificationA notification shown to the user as a response to interacting with a UI element.
OnCloseAn enum that specifies what to do when a URL opened through an OpenLink is closed.
OpenAsAn enum that specifies how to open a URL.
OpenLinkRepresents an action to open a link with some options.
SelectionInputAn input field that allows choosing between a set of predefined options.
SelectionInputTypeType of selection input.
SuggestionsAutocomplete suggestions to supplement a TextInput widget.
SuggestionsResponseA response object that can be returned from a suggestions callback function.
SuggestionsResponseBuilderA builder for SuggestionsResponse objects.
SwitchA UI element that supports being toggled on or off.
SwitchControlTypeType of a Switch widget control.
TextButtonA TextButton with a text label.
TextButtonStyleAn enum that specifies the style for TextButton.
TextInputA input field widget that accepts text input.
TextParagraphA widget that displays text and supports basic HTML formatting.
TimePickerAn input field that allows users to input a time.
UniversalActionResponseThe response object that may be returned from a method that creates universal action.
UniversalActionResponseBuilderA builder for the UniversalActionResponse objects.
UpdateDraftActionResponseRepresents an action that updates the email draft that the user is currently editing.
UpdateDraftActionResponseBuilderA builder for UpdateDraftActionResponse objects.
UpdateDraftBccRecipientsActionUpdates the Bcc recipients of an email draft.
UpdateDraftBodyActionUpdates the email draft body.
UpdateDraftBodyTypeAn enum value that specifies the type of an UpdateDraftBodyAction.
UpdateDraftCcRecipientsActionUpdates the Cc recipients of an email draft.
UpdateDraftSubjectActionUpdates the subject line of an email draft.
UpdateDraftToRecipientsActionUpdates the To recipients of an email draft.
WidgetBase class for all widgets that can be added to a Card.

Action

Methods

MethodReturn typeBrief description
setFunctionName(functionName)ActionSets the name of the callback function to be called.
setLoadIndicator(loadIndicator)ActionSets the loading indicator that displays while the action is in progress.
setParameters(parameters)ActionAllows custom parameters to be passed to the callback function.

ActionResponse

Methods

MethodReturn typeBrief description
printJson()StringPrints the JSON representation of this object.

ActionResponseBuilder

Methods

MethodReturn typeBrief description
build()ActionResponseBuilds the current action response and validates it.
setNavigation(navigation)ActionResponseBuilderSets the response to a Navigation action.
setNotification(notification)ActionResponseBuilderSets the notification to display when the action is activated.
setOpenLink(openLink)ActionResponseBuilderSets the URL to navigate to when the action is activated.
setStateChanged(stateChanged)ActionResponseBuilderSets a flag to indicate that this action changed the existing data state.

AuthorizationAction

Methods

MethodReturn typeBrief description
setAuthorizationUrl(authorizationUrl)AuthorizationActionSets the authorization URL that user is taken to from the authorization prompt.

AuthorizationException

Methods

MethodReturn typeBrief description
printJson()StringPrints the JSON representation of this object.
setAuthorizationUrl(authUrl)AuthorizationExceptionSets the authorization URL that user is taken to from the authorization prompt.
setCustomUiCallback(callback)AuthorizationExceptionThe name of a function to call to generate a custom authorization prompt.
setResourceDisplayName(name)AuthorizationExceptionSets the name that is displayed to the user when asking for authorization.
throwException()voidTriggers this exception to be thrown.

Button

Methods

MethodReturn typeBrief description
setAuthorizationAction(action)ButtonSets an authorization action that opens a URL to the authorization flow when the object is clicked.
setComposeAction(action, composedEmailType)ButtonSets an action that composes a draft email when the object is clicked.
setOnClickAction(action)ButtonSets an action that executes when the object is clicked.
setOnClickOpenLinkAction(action)ButtonSets an action that opens a URL in a tab when the object is clicked.
setOpenLink(openLink)ButtonSets a URL to be opened when the object is clicked.

ButtonSet

Methods

MethodReturn typeBrief description
addButton(button)ButtonSetAdds a button.

CalendarEventActionResponse

Methods

MethodReturn typeBrief description
printJson()StringPrints the JSON representation of this object.

CalendarEventActionResponseBuilder

Methods

MethodReturn typeBrief description
addAttendees(emails)CalendarEventActionResponseBuilderSpecifies that the response should add the indicated attendees to the Calendar event when the associated UI action is taken.
build()CalendarEventActionResponseBuilds the current Calendar event action response and validates it.
setConferenceData(conferenceData)CalendarEventActionResponseBuilderSpecifies that the response should set the indicated conference data to the Calendar event when the associated UI action is taken.

Card

Methods

MethodReturn typeBrief description
printJson()StringPrints the JSON representation of this object.

CardAction

Methods

MethodReturn typeBrief description
setAuthorizationAction(action)CardActionSets an authorization action that opens a URL to the authorization flow when the object is clicked.
setComposeAction(action, composedEmailType)CardActionSets an action that composes a draft email when the object is clicked.
setOnClickAction(action)CardActionSets an action that executes when the object is clicked.
setOnClickOpenLinkAction(action)CardActionSets an action that opens a URL in a tab when the object is clicked.
setOpenLink(openLink)CardActionSets a URL to be opened when the object is clicked.
setText(text)CardActionSets the menu text for this action.

CardBuilder

Methods

MethodReturn typeBrief description
addCardAction(cardAction)CardBuilderAdds a CardAction to this Card.
addSection(section)CardBuilderAdds a section to this card.
build()CardBuilds the current card and validates it.
setDisplayStyle(displayStyle)CardBuilderSets the display style for this card.
setFixedFooter(fixedFooter)CardBuilderSets a fixed footer for this card.
setHeader(cardHeader)CardBuilderSets the header for this card.
setName(name)CardBuilderSets the name for this card.
setPeekCardHeader(peekCardHeader)CardBuilderSets the peek card header.

CardHeader

Methods

MethodReturn typeBrief description
setImageAltText(imageAltText)CardHeaderSets the alternative text for the header image.
setImageStyle(imageStyle)CardHeaderSets the cropping of the icon in then card header.
setImageUrl(imageUrl)CardHeaderSets the image to use in the header by providing its URL or data string.
setSubtitle(subtitle)CardHeaderSets the subtitle of the card header.
setTitle(title)CardHeaderSets the title of the card header.

CardSection

Methods

MethodReturn typeBrief description
addWidget(widget)CardSectionAdds the given widget to this section.
setCollapsible(collapsible)CardSectionSets whether the section can be collapsed.
setHeader(header)CardSectionSets the header of the section.
setNumUncollapsibleWidgets(numUncollapsibleWidgets)CardSectionSets the number of widgets that are still shown when this section is collapsed.

CardService

Properties

PropertyTypeDescription
ComposedEmailTypeComposedEmailTypeThe ComposedEmailType enumeration.
ContentTypeContentTypeThe ContentType enumeration.
IconIconThe Icon enumeration.
ImageStyleImageStyleThe ImageStyle enumeration.
LoadIndicatorLoadIndicatorThe LoadIndicator enumeration.
OnCloseOnCloseThe OnClose enumeration.
OpenAsOpenAsThe OpenAs enumeration.
SelectionInputTypeSelectionInputTypeThe SelectionInputType enumeration.
TextButtonStyleTextButtonStyleThe TextButtonStyle enumeration.
UpdateDraftBodyTypeUpdateDraftBodyTypeThe UpdateDraftBodyType enumeration.

Methods

MethodReturn typeBrief description
newAction()ActionCreates a new Action.
newActionResponseBuilder()ActionResponseBuilderCreates a new ActionResponseBuilder.
newAuthorizationAction()AuthorizationActionCreates a new AuthorizationAction.
newAuthorizationException()AuthorizationExceptionCreates a new AuthorizationException.
newButtonSet()ButtonSetCreates a new ButtonSet.
newCalendarEventActionResponseBuilder()CalendarEventActionResponseBuilderCreates a new CalendarEventActionResponseBuilder.
newCardAction()CardActionCreates a new CardAction.
newCardBuilder()CardBuilderCreates a new CardBuilder.
newCardHeader()CardHeaderCreates a new CardHeader.
newCardSection()CardSectionCreates a new CardSection.
newComposeActionResponseBuilder()ComposeActionResponseBuilderCreates a new ComposeActionResponseBuilder.
newDatePicker()DatePickerCreates a new DatePicker.
newDateTimePicker()DateTimePickerCreates a new DateTimePicker.
newDecoratedText()DecoratedTextCreates a new DecoratedText.
newDriveItemsSelectedActionResponseBuilder()DriveItemsSelectedActionResponseBuilderCreates a new DriveItemsSelectedActionResponseBuilder.
newEditorFileScopeActionResponseBuilder()EditorFileScopeActionResponseBuilderCreates a new EditorFileScopeActionResponseBuilder.
newFixedFooter()FixedFooterCreates a new FixedFooter.
newImage()ImageCreates a new Image.
newImageButton()ImageButtonCreates a new ImageButton.
newKeyValue()KeyValueCreates a new KeyValue.
newNavigation()NavigationCreates a new Navigation.
newNotification()NotificationCreates a new Notification.
newOpenLink()OpenLinkCreates a new OpenLink.
newSelectionInput()SelectionInputCreates a new SelectionInput.
newSuggestions()SuggestionsCreates a new Suggestions.
newSuggestionsResponseBuilder()SuggestionsResponseBuilderCreates a new SuggestionsResponseBuilder.
newSwitch()SwitchCreates a new Switch.
newTextButton()TextButtonCreates a new TextButton.
newTextInput()TextInputCreates a new TextInput.
newTextParagraph()TextParagraphCreates a new TextParagraph.
newTimePicker()TimePickerCreates a new TimePicker.
newUniversalActionResponseBuilder()UniversalActionResponseBuilderCreates a new UniversalActionResponseBuilder.
newUpdateDraftActionResponseBuilder()UpdateDraftActionResponseBuilderCreates a new UpdateDraftActionResponseBuilder.
newUpdateDraftBccRecipientsAction()UpdateDraftBccRecipientsActionCreates a new UpdateDraftBccRecipientsAction;
newUpdateDraftBodyAction()UpdateDraftBodyActionCreates a new UpdateDraftBodyAction.
newUpdateDraftCcRecipientsAction()UpdateDraftCcRecipientsActionCreates a new UpdateDraftCcRecipientsAction.
newUpdateDraftSubjectAction()UpdateDraftSubjectActionCreates a new UpdateDraftSubjectAction.
newUpdateDraftToRecipientsAction()UpdateDraftToRecipientsActionCreates a new UpdateDraftToRecipientsAction.

ComposeActionResponse

Methods

MethodReturn typeBrief description
printJson()StringPrints the JSON representation of this object.

ComposeActionResponseBuilder

Methods

MethodReturn typeBrief description
build()ComposeActionResponseBuilds the current compose action response and validates it.
setGmailDraft(draft)ComposeActionResponseBuilderSets the draft GmailMessage created using GmailMessage.createDraftReply(body) or similar functions.

ComposedEmailType

Properties

PropertyTypeDescription
REPLY_AS_DRAFTEnumA draft that is a reply to another message.
STANDALONE_DRAFTEnumA draft that is a standalone message.

ContentType

Properties

PropertyTypeDescription
TEXTEnumIndicates that the generated content is plain text.
MUTABLE_HTMLEnumIndicates that the generated content is formatted as HTML.
IMMUTABLE_HTMLEnumIndicates that the generated content is formatted as HTML, but this content cannot be edited after it is generated.

DatePicker

Methods

MethodReturn typeBrief description
setFieldName(fieldName)DatePickerSets the field name that identifies this picker in the event object that is generated when there is a UI interaction.
setOnChangeAction(action)DatePickerSets an Action that the script performs whenever the picker input changes.
setTitle(title)DatePickerSets the title displayed above the input field.
setValueInMsSinceEpoch(valueMsEpoch)DatePickerSets the prefilled value to be set in the input field.
setValueInMsSinceEpoch(valueMsEpoch)DatePickerSets the prefilled value to be set in the input field.

DateTimePicker

Methods

MethodReturn typeBrief description
setFieldName(fieldName)DateTimePickerSets the field name that identifies this picker in the event object that is generated when there is a UI interaction.
setOnChangeAction(action)DateTimePickerSets an Action that the script performs whenever the picker input changes.
setTimeZoneOffsetInMins(timeZoneOffsetMins)DateTimePickerSets the number of minutes that the time zone should be offset from UTC.
setTitle(title)DateTimePickerSets the title displayed above the input field.
setValueInMsSinceEpoch(valueMsEpoch)DateTimePickerSets the prefilled value to be set in the input field.
setValueInMsSinceEpoch(valueMsEpoch)DateTimePickerSets the prefilled value to be set in the input field.

DecoratedText

Methods

MethodReturn typeBrief description
setAuthorizationAction(action)DecoratedTextSets an authorization action that opens a URL to the authorization flow when the object is clicked.
setBottomLabel(text)DecoratedTextSets the label text to be used as the key and is displayed below the text content.
setButton(button)DecoratedTextSets the Button that is displayed to the right of the text.
setComposeAction(action, composedEmailType)DecoratedTextSets an action that composes a draft email when the object is clicked.
setIcon(icon)DecoratedTextSets the icon to be used as the key.
setIconAltText(altText)DecoratedTextSets the alternative text for the icon.
setIconUrl(url)DecoratedTextSets the URL of the icon to be used as the key.
setOnClickAction(action)DecoratedTextSets an action that executes when the object is clicked.
setOnClickOpenLinkAction(action)DecoratedTextSets an action that opens a URL in a tab when the object is clicked.
setOpenLink(openLink)DecoratedTextSets a URL to be opened when the object is clicked.
setSwitchControl(switchToSet)DecoratedTextSets the Switch that is displayed to the right of the content.
setText(text)DecoratedTextSets the text to be used as the value.
setTopLabel(text)DecoratedTextSets the label text to be used as the key and is displayed above the text content.
setWrapText(wrapText)DecoratedTextSets whether the value text should be displayed on a single line or multiple lines.

DisplayStyle

Properties

PropertyTypeDescription
PEEKEnumShow the card header at the bottom of add-on content over existing content.
REPLACEEnumShow the card by replacing existing content.

DriveItemsSelectedActionResponse

Methods

MethodReturn typeBrief description
printJson()StringPrints the JSON representation of this object.

DriveItemsSelectedActionResponseBuilder

Methods

MethodReturn typeBrief description
build()DriveItemsSelectedActionResponseBuilds the current Drive action response.
requestFileScope(itemId)DriveItemsSelectedActionResponseBuilderSpecifies that the response requests file scope for the contextually-relevant item in Drive.

EditorFileScopeActionResponse

Methods

MethodReturn typeBrief description
printJson()StringPrints the JSON representation of this object.

EditorFileScopeActionResponseBuilder

Methods

MethodReturn typeBrief description
build()EditorFileScopeActionResponseBuilds the current Editor action response.
requestFileScopeForActiveDocument()EditorFileScopeActionResponseBuilderRequests the drive.file scope for the current active Editor document.

FixedFooter

Methods

MethodReturn typeBrief description
setPrimaryButton(button)FixedFooterSet the primary button in the fixed footer.
setSecondaryButton(button)FixedFooterSet the secondary button in the fixed footer.

Icon

Properties

PropertyTypeDescription
NONEEnumNo icon.
AIRPLANEEnumAirplane flight icon
BOOKMARKEnumBookmark icon
BUSEnumBus icon
CAREnumCar icon
CLOCKEnumClock icon
CONFIRMATION_NUMBER_ICONEnumConfirmation number icon
DOLLAREnumDollar icon
DESCRIPTIONEnumDescription icon
EMAILEnumEmail icon
EVENT_PERFORMEREnumEmail icon
EVENT_SEATEnumEvent seat icon
FLIGHT_ARRIVALEnumFlight arrival icon
FLIGHT_DEPARTUREEnumFlight departure icon
HOTELEnumHotel icon
HOTEL_ROOM_TYPEEnumHotel icon
INVITEEnumInvite icon
MAP_PINEnumMap pin icon
MEMBERSHIPEnumMembershipt icon
MULTIPLE_PEOPLEEnumMultiple people icon
OFFEREnumOffer icon
PERSONEnumPerson icon
PHONEEnumPhone icon
RESTAURANT_ICONEnumRestaurant icon
SHOPPING_CARTEnumShopping cart icon
STAREnumStar icon
STOREEnumStore icon
TICKETEnumTicket icon
TRAINEnumTrain icon
VIDEO_CAMERAEnumVideo camera icon
VIDEO_PLAYEnumVideo play icon

Image

Methods

MethodReturn typeBrief description
setAltText(altText)ImageSets the alternative text of the image for accessibility.
setAuthorizationAction(action)ImageSets an authorization action that opens a URL to the authorization flow when the object is clicked.
setComposeAction(action, composedEmailType)ImageSets an action that composes a draft email when the object is clicked.
setImageUrl(url)ImageSets the image to use by providing its URL or data string.
setOnClickAction(action)ImageSets an action that executes when the object is clicked.
setOnClickOpenLinkAction(action)ImageSets an action that opens a URL in a tab when the object is clicked.
setOpenLink(openLink)ImageSets a URL to be opened when the object is clicked.

ImageButton

Methods

MethodReturn typeBrief description
setAltText(altText)ImageButtonSets the alternative text of the button for accessibility.
setAuthorizationAction(action)ImageButtonSets an authorization action that opens a URL to the authorization flow when the object is clicked.
setComposeAction(action, composedEmailType)ImageButtonSets an action that composes a draft email when the object is clicked.
setIcon(icon)ImageButtonSets a predefined Icon to display on the button.
setIconUrl(url)ImageButtonSets the URL of an image to use as this button's icon.
setOnClickAction(action)ImageButtonSets an action that executes when the object is clicked.
setOnClickOpenLinkAction(action)ImageButtonSets an action that opens a URL in a tab when the object is clicked.
setOpenLink(openLink)ImageButtonSets a URL to be opened when the object is clicked.

ImageCropType

Properties

PropertyTypeDescription
SQUAREEnumSquare shape crop style.
CIRCLEEnumCircle shape crop style.
RECTANGLE_CUSTOMEnumRectangle shape crop style with custom ratio.
RECTANGLE_4_3EnumRectangle shape crop style with 4:3 ratio.

ImageStyle

Properties

PropertyTypeDescription
SQUAREEnumNo cropping.
CIRCLEEnumCrop to a circle shape.

KeyValue

Methods

MethodReturn typeBrief description
setAuthorizationAction(action)KeyValueSets an authorization action that opens a URL to the authorization flow when the object is clicked.
setBottomLabel(text)KeyValueSets the label text to be used as the key.
setButton(button)KeyValueSets the Button that is displayed to the right of the context.
setComposeAction(action, composedEmailType)KeyValueSets an action that composes a draft email when the object is clicked.
setContent(text)KeyValueSets the text to be used as the value.
setIcon(icon)KeyValueSets the icon to be used as the key.
setIconAltText(altText)KeyValueSets the alternative text for the icon.
setIconUrl(url)KeyValueSets the URL of the icon to be used as the key.
setMultiline(multiline)KeyValueSets whether the value text should be displayed on a single line or multiple lines.
setOnClickAction(action)KeyValueSets an action that executes when the object is clicked.
setOnClickOpenLinkAction(action)KeyValueSets an action that opens a URL in a tab when the object is clicked.
setOpenLink(openLink)KeyValueSets a URL to be opened when the object is clicked.
setSwitch(switchToSet)KeyValueSets the Switch that is displayed to the right of the content.
setTopLabel(text)KeyValueSets the label text to be used as the key.

LoadIndicator

Properties

PropertyTypeDescription
SPINNEREnumUse a spinner indicator.
NONEEnumDo not use an indicator.

Methods

MethodReturn typeBrief description
popCard()NavigationPops a card from the navigation stack.
popToNamedCard(cardName)NavigationPops to the specified card by its card name.
popToRoot()NavigationPops the card stack to the root card.
printJson()StringPrints the JSON representation of this object.
pushCard(card)NavigationPushes the given card onto the stack.
updateCard(card)NavigationDoes an in-place replacement of the current card.

Notification

Methods

MethodReturn typeBrief description
setText(text)NotificationSets the text to show in the notification.

OnClose

Properties

PropertyTypeDescription
NOTHINGEnumDo nothing on close.
RELOAD_ADD_ONEnumReload the add-on on closing the URL.

OpenAs

Properties

PropertyTypeDescription
FULL_SIZEEnumOpen in a full window or tab.
OVERLAYEnumOpen as an overlay such as a pop-up.

Methods

MethodReturn typeBrief description
setOnClose(onClose)OpenLinkSets the behavior of the URL action when the URL window or tab is closed.
setOpenAs(openAs)OpenLinkSets the behavior of URL when it is opened.
setUrl(url)OpenLinkSets the URL to be opened.

SelectionInput

Methods

MethodReturn typeBrief description
addItem(text, value, selected)SelectionInputAdds a new item that can be selected.
setFieldName(fieldName)SelectionInputSets the key that identifies this selection input in the event object that is generated when there is a UI interaction.
setOnChangeAction(action)SelectionInputSets an Action to be performed whenever the selection input changes.
setTitle(title)SelectionInputSets the title to be shown ahead of the input field.
setType(type)SelectionInputSets the type of this input.

SelectionInputType

Properties

PropertyTypeDescription
CHECK_BOXEnumCheckbox input style.
RADIO_BUTTONEnumRadio buton input style.
DROPDOWNEnumDropdown menu selection input style.

Suggestions

Methods

MethodReturn typeBrief description
addSuggestion(suggestion)SuggestionsAdd a text suggestion.
addSuggestions(suggestions)SuggestionsAdd a list of text suggestions.

SuggestionsResponse

Methods

MethodReturn typeBrief description
printJson()StringPrints the JSON representation of this object.

SuggestionsResponseBuilder

Methods

MethodReturn typeBrief description
build()SuggestionsResponseBuilds the current suggestions response and validates it.
setSuggestions(suggestions)SuggestionsResponseBuilderSets the suggestions used in auto complete in text fields.

Switch

Methods

MethodReturn typeBrief description
setControlType(controlType)SwitchSets the control type of the switch.
setFieldName(fieldName)SwitchSets the key that identifies this switch in the event object that is generated when there is a UI interaction.
setOnChangeAction(action)SwitchSets the action to take when the switch is toggled.
setSelected(selected)SwitchSets whether this switch should start as selected or unselected.
setValue(value)SwitchSets the value that is sent as the form input when this switch is toggled on.

SwitchControlType

Properties

PropertyTypeDescription
SWITCHEnumToggle-styled control for a switch widget.
CHECK_BOXEnumCheckbox-styled control for a switch widget.

TextButton

Methods

MethodReturn typeBrief description
setAuthorizationAction(action)TextButtonSets an authorization action that opens a URL to the authorization flow when the object is clicked.
setBackgroundColor(backgroundColor)TextButtonSets the background color for TextButtonStyle.FILLED button.
setComposeAction(action, composedEmailType)TextButtonSets an action that composes a draft email when the object is clicked.
setDisabled(disabled)TextButtonSets whether the button is disabled.
setOnClickAction(action)TextButtonSets an action that executes when the object is clicked.
setOnClickOpenLinkAction(action)TextButtonSets an action that opens a URL in a tab when the object is clicked.
setOpenLink(openLink)TextButtonSets a URL to be opened when the object is clicked.
setText(text)TextButtonSets the text to be displayed on the button.
setTextButtonStyle(textButtonStyle)TextButtonSets the button style.

TextButtonStyle

Properties

PropertyTypeDescription
TEXTEnumNormal text button with clear background.
FILLEDEnumText button with colored background.

TextInput

Methods

MethodReturn typeBrief description
setFieldName(fieldName)TextInputSets the key that identifies this text input in the event object that is generated when there is a UI interaction.
setHint(hint)TextInputSets a hint for the text input.
setMultiline(multiline)TextInputSets whether the input text shows on one line or multiple lines.
setOnChangeAction(action)TextInputSets an action to be performed whenever the text input changes.
setSuggestions(suggestions)TextInputSets the suggestions for autocompletion in the text field.
setSuggestionsAction(suggestionsAction)TextInputSets the callback action to fetch suggestions based on user input for autocompletion.
setTitle(title)TextInputSets the title to be shown above the input field.
setValue(value)TextInputSets the pre-filled value to be set in the input field.

TextParagraph

Methods

MethodReturn typeBrief description
setText(text)TextParagraphSets the text of the paragraph.

TimePicker

Methods

MethodReturn typeBrief description
setFieldName(fieldName)TimePickerSets the field name that identifies this picker in the event object that is generated when there is a UI interaction.
setHours(hours)TimePickerSets the prefilled hours value to set in the input field.
setMinutes(minutes)TimePickerSets the prefilled minutes value to set in the input field.
setOnChangeAction(action)TimePickerSets an Action that the script performs whenever the picker input changes.
setTitle(title)TimePickerSets the title displayed above the input field.

UniversalActionResponse

Methods

MethodReturn typeBrief description
printJson()StringPrints the JSON representation of this object.

UniversalActionResponseBuilder

Methods

MethodReturn typeBrief description
build()UniversalActionResponseBuilds the current universal action response and validates it.
displayAddOnCards(cardObjects)UniversalActionResponseBuilderDisplays the add-on with the specified cards.
setOpenLink(openLink)UniversalActionResponseBuilderSets the URL to open when the universal action is selected.

UpdateDraftActionResponse

Methods

MethodReturn typeBrief description
printJson()StringPrints the JSON representation of this object.

UpdateDraftActionResponseBuilder

Methods

MethodReturn typeBrief description
build()UpdateDraftActionResponseBuilds the current update draft action response and validates it.
setUpdateDraftBccRecipientsAction(updateDraftBccRecipientsAction)UpdateDraftActionResponseBuilderSets an action that updates the email Bcc recipients of a draft.
setUpdateDraftBodyAction(updateDraftBodyAction)UpdateDraftActionResponseBuilderSet an action that updates the email body of a draft.
setUpdateDraftCcRecipientsAction(updateDraftCcRecipientsAction)UpdateDraftActionResponseBuilderSets an action that updates the Cc recipients of a draft.
setUpdateDraftSubjectAction(updateDraftSubjectAction)UpdateDraftActionResponseBuilderSets an action that updates the subject line of a draft.
setUpdateDraftToRecipientsAction(updateDraftToRecipientsAction)UpdateDraftActionResponseBuilderSets an action that updates the To recipients of a draft.

UpdateDraftBccRecipientsAction

Methods

MethodReturn typeBrief description
addUpdateBccRecipients(bccRecipientEmails)UpdateDraftBccRecipientsActionUpdates the Bcc recipients of an email draft.

UpdateDraftBodyAction

Methods

MethodReturn typeBrief description
addUpdateContent(content, contentType)UpdateDraftBodyActionAdds the specified content to the draft body.
setUpdateType(updateType)UpdateDraftBodyActionSets the UpdateDraftBodyType of this update action on the draft body.

UpdateDraftBodyType

Properties

PropertyTypeDescription
IN_PLACE_INSERTEnumDefault.
INSERT_AT_STARTEnumUpdate actions insert content at the start of message body.
INSERT_AT_ENDEnumUpdate actions insert content at the end of the message body.

UpdateDraftCcRecipientsAction

Methods

MethodReturn typeBrief description
addUpdateCcRecipients(ccRecipientEmails)UpdateDraftCcRecipientsActionUpdates the Cc recipients of an email draft.

UpdateDraftSubjectAction

Methods

MethodReturn typeBrief description
addUpdateSubject(subject)UpdateDraftSubjectActionUpdates the subject line of an email draft.

UpdateDraftToRecipientsAction

Methods

MethodReturn typeBrief description
addUpdateToRecipients(toRecipientEmails)UpdateDraftToRecipientsActionUpdates the To recipients of an email draft.

Widget