DynamicResourceDefinition

A DynamicResourceDefinition is a building block for a `https://developers.google.com/apps-script/reference/add-ons-response-service/resource-fields-definition-retrieved-action`, it can contain one or more numbers of `https://developers.google.com/apps-script/reference/add-ons-response-service/resource-field` to dynamically define the number of output variables provided by a step in Google
Workspace Studio.

Only available for Google Workspace add-ons that extend Google Workspace Studio.

Sample usage:

```javascript
let dynamicResourceDefinition = AddOnsResponseService.newDynamicResourceDefinition()
   .setResourceId("resource_definition_1") // The resource ID must match the one defined in the manifest.
   .addResourceField(
     AddOnsResponseService.newResourceField()
       .setSelector("question_1")
       .setDisplayText("Question 1")
   );
```

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `https://developers.google.com/apps-script/reference/add-ons-response-service/dynamic-resource-definition#addResourceField(ResourceField)` | `https://developers.google.com/apps-script/reference/add-ons-response-service/dynamic-resource-definition#` | Adds a resource field to the dynamic resource definition. |
| `https://developers.google.com/apps-script/reference/add-ons-response-service/dynamic-resource-definition#setResourceId(String)` | `https://developers.google.com/apps-script/reference/add-ons-response-service/dynamic-resource-definition#` | Sets the ID for the dynamic resource definition, this ID corresponds to the `workflowResourceDefinitionId` in the manifest. |

## Detailed documentation

### `addResourceField(resourceField)`

Adds a resource field to the dynamic resource definition.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `resourceField` | `https://developers.google.com/apps-script/reference/add-ons-response-service/resource-field` | The resource field to add. |

#### Return


`https://developers.google.com/apps-script/reference/add-ons-response-service/dynamic-resource-definition#` --- This object, for chaining.

*** ** * ** ***

### `setResourceId(resourceId)`

Sets the ID for the dynamic resource definition, this ID corresponds to the `workflowResourceDefinitionId` in the manifest.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `resourceId` | `String` | The unique identifier for the dynamic resource definition. |

#### Return


`https://developers.google.com/apps-script/reference/add-ons-response-service/dynamic-resource-definition#` --- This object, for chaining.