ResourceField

A ResourceField is a basic building block of a `https://developers.google.com/apps-script/reference/add-ons-response-service/dynamic-resource-definition`, each resource
field corresponds to a output variable of the current step. A single `https://developers.google.com/apps-script/reference/add-ons-response-service/dynamic-resource-definition` can contain multiple resource fields.

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

Sample usage:

```javascript
function onDynamicDefinitionFunction(e) {
  // ...
  let resourceField = AddOnsResponseService.newResourceField()
    .setSelector("question_1")
    .setDisplayText("Question 1")
    .setDataType(AddOnsResponseService.newDataType()
       .setBasicDataType(AddOnsResponseService.BasicDataType.STRING)
    );

  let resourceDefinitions = AddOnsResponseService.newDynamicResourceDefinition()
    .setResourceId("resource_definition_1")
    .addResourceField(resourceField);
  // ...
}

function onDynamicProviderFunction(e) {
  // ...
  let workflowAction = AddOnsResponseService.newResourceRetrievedAction()
    .setResourceData(
      AddOnsResponseService.newResourceData()
        .addVariableData("question_1", AddOnsResponseService.newVariableData().addStringValue("Answer 1"))
    );
  // ...
}
```

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `https://developers.google.com/apps-script/reference/add-ons-response-service/resource-field#setDataType(DataType)` | `https://developers.google.com/apps-script/reference/add-ons-response-service/resource-field#` | Sets the data type of the field, allows other steps to filter the variables by type at selection. |
| `https://developers.google.com/apps-script/reference/add-ons-response-service/resource-field#setDisplayText(String)` | `https://developers.google.com/apps-script/reference/add-ons-response-service/resource-field#` | Sets the description of the field that is displayed to the end user during variable selection in subsequent steps. |
| `https://developers.google.com/apps-script/reference/add-ons-response-service/resource-field#setSelector(String)` | `https://developers.google.com/apps-script/reference/add-ons-response-service/resource-field#` | Sets a key for the provider function to provide the value to during the step's execution. |

## Detailed documentation

### `setDataType(dataType)`

Sets the data type of the field, allows other steps to filter the variables by type at
selection.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `dataType` | `https://developers.google.com/apps-script/reference/add-ons-response-service/data-type` | A data type object, which can be a basic data type or a custom resource type. |

#### Return


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

*** ** * ** ***

### `setDisplayText(displayText)`

Sets the description of the field that is displayed to the end user during variable selection
in subsequent steps.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `displayText` | `String` | The description for end users at variable selection. |

#### Return


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

*** ** * ** ***

### `setSelector(selector)`

Sets a key for the provider function to provide the value to during the step's execution.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `selector` | `String` | The field's reference key used to retrieve its associated `https://developers.google.com/apps-script/reference/add-ons-response-service/variable-data` with the same key used in `https://developers.google.com/apps-script/reference/add-ons-response-service/resource-data`. |

#### Return


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