Class Action

Action

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

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.

Detailed documentation

setFunctionName(functionName)

Sets the name of the callback function to be called. Required.

Parameters

NameTypeDescription
functionNameStringthe name of the function.

Return

Action — this object, for chaining.


setLoadIndicator(loadIndicator)

Sets the loading indicator that displays while the action is in progress.

Parameters

NameTypeDescription
loadIndicatorLoadIndicatorthe indicator to display.

Return

Action — this object, for chaining.


setParameters(parameters)

Allows custom parameters to be passed to the callback function. Optional.

Parameters

NameTypeDescription
parametersObjectBoth keys and values must be strings.

Return

Action — this object, for chaining.

Deprecated methods

Send feedback about...

Apps Script
Apps Script