Stay organized with collections
Save and categorize content based on your preferences.
ActionResponse
The response object that may be returned from a callback function (e.g., a form response handler)
to perform one or more actions on the client. Some combinations of actions are not supported.
// An action that opens a linkconstactionResponse=CardService.newActionResponseBuilder().setOpenLink(CardService.newOpenLink().setUrl('https://www.google.com')).build();// An action that shows a notification.constnotificationActionResponse=CardService.newActionResponseBuilder().setNotification(CardService.newNotification().setText('Some info to display to user'),).build();// An action that shows an additional card. It also sets a flag to indicate that// the original state data has changed.constcardBuilder=CardService.newCardBuilder();// Build card ...constnavigationActionResponse=CardService.newActionResponseBuilder().setNavigation(CardService.newNavigation().pushCard(cardBuilder.build())).setStateChanged(true).build();
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-12-02 UTC."],[[["\u003cp\u003e\u003ccode\u003eActionResponse\u003c/code\u003e enables callback functions to trigger actions like opening links, displaying notifications, and navigating between cards within Google Workspace add-ons.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can use \u003ccode\u003eActionResponseBuilder\u003c/code\u003e methods to define these actions and control client-side behavior based on user interactions.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eprintJson()\u003c/code\u003e method helps with debugging by providing the JSON representation of the \u003ccode\u003eActionResponse\u003c/code\u003e object.\u003c/p\u003e\n"]]],["The `ActionResponse` object enables client-side actions from callback functions. It supports actions like opening a link, displaying a notification, or showing a new card. `setOpenLink` opens a specified URL, `setNotification` displays text to the user, and `setNavigation` pushes a new card. `setStateChanged` indicates changes in original data. `printJson()` provides a JSON representation of the object for debugging. Certain action combinations may be unsupported.\n"],null,["ActionResponse\n\nThe response object that may be returned from a callback function (e.g., a form response handler)\nto perform one or more actions on the client. Some combinations of actions are not supported.\n\n```javascript\n// An action that opens a link\nconst actionResponse =\n CardService.newActionResponseBuilder()\n .setOpenLink(CardService.newOpenLink().setUrl('https://www.google.com'))\n .build();\n\n// An action that shows a notification.\nconst notificationActionResponse = CardService.newActionResponseBuilder()\n .setNotification(\n CardService.newNotification().setText(\n 'Some info to display to user'),\n )\n .build();\n\n// An action that shows an additional card. It also sets a flag to indicate that\n// the original state data has changed.\n\nconst cardBuilder = CardService.newCardBuilder();\n// Build card ...\nconst navigationActionResponse = CardService.newActionResponseBuilder()\n .setNavigation(CardService.newNavigation().pushCard(\n cardBuilder.build()))\n .setStateChanged(true)\n .build();\n``` \n\nMethods\n\n| Method | Return type | Brief description |\n|-----------------------------|-------------|------------------------------------------------|\n| [printJson()](#printJson()) | `String` | Prints the JSON representation of this object. |\n\nDetailed documentation \n\n`print``Json()` \nPrints the JSON representation of this object. This is for debugging only.\n\nReturn\n\n\n`String`"]]