تُستخدَم لضبط علامة للإشارة إلى أنّ هذا الإجراء قد غيّر حالة البيانات الحالية. على سبيل المثال، إذا أنشأ الإجراء مهمة أو عدّل معلومات الاتصال. عند ضبط هذه العلامة على true، يمكن للخدمات
مثل Gmail محاولة محو أي بيانات حالة محفوظة مؤقتًا مرتبطة بهذا الإجراء.
المعلَمات
الاسم
النوع
الوصف
stateChanged
Boolean
ما إذا كان هذا الإجراء قد غيّر بيانات الحالة الحالية القيمة التلقائية هي false.
تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","easyToUnderstand","thumb-up"],["ساعَدني المحتوى في حلّ مشكلتي.","solvedMyProblem","thumb-up"],["غير ذلك","otherUp","thumb-up"]],[["لا يحتوي على المعلومات التي أحتاج إليها.","missingTheInformationINeed","thumb-down"],["الخطوات معقدة للغاية / كثيرة جدًا.","tooComplicatedTooManySteps","thumb-down"],["المحتوى قديم.","outOfDate","thumb-down"],["ثمة مشكلة في الترجمة.","translationIssue","thumb-down"],["مشكلة في العيّنات / التعليمات البرمجية","samplesCodeIssue","thumb-down"],["غير ذلك","otherDown","thumb-down"]],["تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003e\u003ccode\u003eActionResponseBuilder\u003c/code\u003e helps create responses for actions within Google Apps Script cards.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods to define navigation, notifications, open links, and signal state changes when an action is performed.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ebuild()\u003c/code\u003e method finalizes the response and ensures its validity before execution.\u003c/p\u003e\n"],["\u003cp\u003eMethods like \u003ccode\u003esetNavigation()\u003c/code\u003e, \u003ccode\u003esetNotification()\u003c/code\u003e, \u003ccode\u003esetOpenLink()\u003c/code\u003e, and \u003ccode\u003esetStateChanged()\u003c/code\u003e allow customization of the action's outcome.\u003c/p\u003e\n"],["\u003cp\u003eUsing an \u003ccode\u003eActionResponseBuilder\u003c/code\u003e streamlines the process of defining how user interactions within a card trigger specific application behaviors.\u003c/p\u003e\n"]]],["The `ActionResponseBuilder` constructs `ActionResponse` objects. Key actions include: `build()`, which creates and validates the response; `setNavigation()`, which sets a navigation action; `setNotification()`, which sets a notification to display; `setOpenLink()`, which sets a URL for navigation; and `setStateChanged()`, which flags if the action modifies existing data. Each setter method allows for chaining and accepts specific object types like `Navigation`, `Notification`, or `OpenLink` to define the response.\n"],null,["# Class ActionResponseBuilder\n\nActionResponseBuilder\n\nA builder for [ActionResponse](/apps-script/reference/card-service/action-response) objects. \n\n### Methods\n\n| Method | Return type | Brief description |\n|-----------------------------------------------------------------|-----------------------------------------------------------------------|---------------------------------------------------------------------------------------------|\n| [build()](#build()) | [ActionResponse](/apps-script/reference/card-service/action-response) | Builds the current action response and validates it. |\n| [setNavigation(navigation)](#setNavigation(Navigation)) | [ActionResponseBuilder](#) | Sets the response to a [Navigation](/apps-script/reference/card-service/navigation) action. |\n| [setNotification(notification)](#setNotification(Notification)) | [ActionResponseBuilder](#) | Sets the notification to display when the action is activated. |\n| [setOpenLink(openLink)](#setOpenLink(OpenLink)) | [ActionResponseBuilder](#) | Sets the URL to navigate to when the action is activated. |\n| [setStateChanged(stateChanged)](#setStateChanged(Boolean)) | [ActionResponseBuilder](#) | Sets a flag to indicate that this action changed the existing data state. |\n\nDetailed documentation\n----------------------\n\n### `build()`\n\nBuilds the current action response and validates it.\n\n#### Return\n\n\n[ActionResponse](/apps-script/reference/card-service/action-response) --- A validated ActionResponse.\n\n#### Throws\n\n\n[`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) --- if the constructed action response isn't valid.\n\n*** ** * ** ***\n\n### `set``Navigation(navigation)`\n\nSets the response to a [Navigation](/apps-script/reference/card-service/navigation) action.\n\n#### Parameters\n\n| Name | Type | Description |\n|--------------|--------------------------------------------------------------|--------------------------------------------------------------------------|\n| `navigation` | [Navigation](/apps-script/reference/card-service/navigation) | The [Navigation](/apps-script/reference/card-service/navigation) to use. |\n\n#### Return\n\n\n[ActionResponseBuilder](#) --- This object, for chaining.\n\n*** ** * ** ***\n\n### `set``Notification(notification)`\n\nSets the notification to display when the action is activated.\n\n#### Parameters\n\n| Name | Type | Description |\n|----------------|------------------------------------------------------------------|------------------------------------------------------------------------------|\n| `notification` | [Notification](/apps-script/reference/card-service/notification) | The [Notification](/apps-script/reference/card-service/notification) to use. |\n\n#### Return\n\n\n[ActionResponseBuilder](#) --- This object, for chaining.\n\n*** ** * ** ***\n\n### `set``Open``Link(openLink)`\n\nSets the URL to navigate to when the action is activated.\n\n#### Parameters\n\n| Name | Type | Description |\n|--------------|-----------------------------------------------------------|-----------------------------------------------------------------------|\n| `open``Link` | [OpenLink](/apps-script/reference/card-service/open-link) | The [OpenLink](/apps-script/reference/card-service/open-link) to use. |\n\n#### Return\n\n\n[ActionResponseBuilder](#) --- This object, for chaining.\n\n*** ** * ** ***\n\n### `set``State``Changed(stateChanged)`\n\nSets a flag to indicate that this action changed the existing data state. For example, if the\naction created a task or updated contact information. When this flag is set to true, services\nsuch as Gmail can attempt to clear any cached state data associated with this action.\n\n#### Parameters\n\n| Name | Type | Description |\n|------------------|-----------|-----------------------------------------------------------------------------|\n| `state``Changed` | `Boolean` | Whether this action has changed the existing state data. Defaults to false. |\n\n#### Return\n\n\n[ActionResponseBuilder](#) --- This object, for chaining."]]