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. 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

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