For a SelectionInput
widget that uses a multiselect menu, a data source from Google
Workspace. Used to populate items in a multiselect menu.
const platformDataSource = CardService . newPlatformDataSource () . setCommonDataSource ( CardService . CommonDataSource . USER ); const multiSelect = 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
Method | Return type | Brief description |
---|---|---|
PlatformDataSource
|
Sets the data source from Google Workspace. | |
PlatformDataSource
|
Used to populate spaces in multiselect menu. |
Detailed documentation
setCommonDataSource(commonDataSource)
Sets the data source from Google Workspace.
const platformDataSource = CardService . newPlatformDataSource () . setCommonDataSource ( CardService . CommonDataSource . USER ); const multiSelect = CardService . newSelectionInput () . setType ( CardService . SelectionInputType . MULTI_SELECT ) . setFieldName ( "contacts" ) . setTitle ( "Selected contacts" ) . setMultiSelectMaxSelectedItems ( 5 ) . setMultiSelectMinQueryLength ( 1 ) . setPlatformDataSource ( platformDataSource );
Parameters
Name | Type | Description |
---|---|---|
commonDataSource
|
CommonDataSource
|
The data source to be set. |
Return
PlatformDataSource
— This object, for chaining.
setHostAppDataSource(hostAppDataSource)
Used to populate spaces in multiselect menu.
const chatSpaceDataSource = CardService . newChatSpaceDataSource () . setDefaultToCurrentSpace ( true ); const chatClientDataSource = CardService . newChatClientDataSource () . setSpaceDataSource ( chatSpaceDataSource ); const hostAppDataSource = CardService . newHostAppDataSource () . setChatDataSource ( chatClientDataSource ); const platformDataSource = CardService . newPlatformDataSource () . setHostAppDataSource ( hostAppDataSource ); const multiSelect = CardService . newSelectionInput () . setType ( CardService . SelectionInputType . MULTI_SELECT ) . setFieldName ( "contacts" ) . setTitle ( "Selected contacts" ) . setMultiSelectMaxSelectedItems ( 5 ) . setMultiSelectMinQueryLength ( 1 ) . setPlatformDataSource ( platformDataSource );
Parameters
Name | Type | Description |
---|---|---|
hostAppDataSource
|
HostAppDataSource
|
The data source to be set. |
Return
PlatformDataSource
— This object, for chaining.