Class PlatformDataSource

  • PlatformDataSource is used for populating items in a multiselect menu within a SelectionInput widget.

  • This feature is exclusively available for Google Chat apps and cannot be used with Google Workspace add-ons.

  • You can set the data source using setCommonDataSource for Google Workspace data or setHostAppDataSource for populating spaces in a multiselect menu.

PlatformDataSource

For a SelectionInput widget that uses a multiselect menu, a data source from Google Workspace. Used to populate items in a multiselect menu.

constplatformDataSource=
CardService.newPlatformDataSource().setCommonDataSource(
CardService.CommonDataSource.USER,
);
constmultiSelect=CardService.newSelectionInput()
.setType(CardService.SelectionInputType.MULTI_SELECT)
.setFieldName('contacts')
.setTitle('Selected contacts')
.setMultiSelectMaxSelectedItems(5)
.setMultiSelectMinQueryLength(1)
.setPlatformDataSource(platformDataSource);

Only available for Google Chat apps. Not available for Google Workspace add-ons.

Methods

MethodReturn typeBrief description
setCommonDataSource(commonDataSource) PlatformDataSource Sets the data source from Google Workspace.
setHostAppDataSource(hostAppDataSource) PlatformDataSource Used to populate spaces in multiselect menu.

Detailed documentation

setCommonDataSource(commonDataSource)

Sets the data source from Google Workspace.

constplatformDataSource=
CardService.newPlatformDataSource().setCommonDataSource(
CardService.CommonDataSource.USER,
);
constmultiSelect=CardService.newSelectionInput()
.setType(CardService.SelectionInputType.MULTI_SELECT)
.setFieldName('contacts')
.setTitle('Selected contacts')
.setMultiSelectMaxSelectedItems(5)
.setMultiSelectMinQueryLength(1)
.setPlatformDataSource(platformDataSource);
Only available for Google Chat apps. Not available for Google Workspace add-ons.

Parameters

NameTypeDescription
commonDataSourceCommonDataSource The data source to be set.

Return

PlatformDataSource — This object, for chaining.


setHostAppDataSource(hostAppDataSource)

Used to populate spaces in multiselect menu.

constchatSpaceDataSource=
CardService.newChatSpaceDataSource().setDefaultToCurrentSpace(true);
constchatClientDataSource=
CardService.newChatClientDataSource().setSpaceDataSource(
chatSpaceDataSource);
consthostAppDataSource=
CardService.newHostAppDataSource().setChatDataSource(chatClientDataSource);
constplatformDataSource=
CardService.newPlatformDataSource().setHostAppDataSource(hostAppDataSource);
constmultiSelect=CardService.newSelectionInput()
.setType(CardService.SelectionInputType.MULTI_SELECT)
.setFieldName('contacts')
.setTitle('Selected contacts')
.setMultiSelectMaxSelectedItems(5)
.setMultiSelectMinQueryLength(1)
.setPlatformDataSource(platformDataSource);
Only available for Google Chat apps. Not available for Google Workspace add-ons.

Parameters

NameTypeDescription
hostAppDataSourceHostAppDataSource The data source to be set.

Return

PlatformDataSource — This object, for chaining.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年01月30日 UTC.