An action that enables interactivity within UI elements. The action does not happen directly on the client but rather invokes an Apps Script callback function with optional parameters.
var image = CardService.newImage() .setOnClickAction(CardService.newAction() .setFunctionName("handleImageClick") .setParameters({imageSrc: 'carImage'}));
Methods
Method | Return type | Brief description |
---|---|---|
setFunctionName(functionName) | Action | Sets the name of the callback function to be called. |
setLoadIndicator(loadIndicator) | Action | Sets the loading indicator that displays while the action is in progress. |
setParameters(parameters) | Action | Allows custom parameters to be passed to the callback function. |
Detailed documentation
setFunctionName(functionName)
Sets the name of the callback function to be called. Required.
Parameters
Name | Type | Description |
---|---|---|
functionName | String | The name of the function. You can use functions from included libraries,
such as Library.libFunction1 . |
Return
Action
— This object, for chaining.
setLoadIndicator(loadIndicator)
Sets the loading indicator that displays while the action is in progress.
Parameters
Name | Type | Description |
---|---|---|
loadIndicator | LoadIndicator | The indicator to display. |
Return
Action
— This object, for chaining.
setParameters(parameters)
Allows custom parameters to be passed to the callback function. Optional.
Parameters
Name | Type | Description |
---|---|---|
parameters | Object | Both keys and values must be strings. |
Return
Action
— This object, for chaining.