---
title: "Questions"
site: api
version: 2027.1
versions: "all"
url: https://docs-new.servicely.ai/api/2027.1/scripting/records/questions/
type: reference
application: platform
last_updated: 2026-12-03
commit: 6777698daac5
---


The Questions object holds the catalog questions answered when a record was created from a catalog item. You use it in server scripts to read each answer, its prompt and its display value.

## Get an instance

Call `questions()` on a [TableRecord](page:scripting/records/table-record). It returns `null` when the record has no questions, so test with `hasQuestions()` first if you are not sure.

```javascript
if (current.hasQuestions()) {
    let questions = current.questions();
}
```

Each question is a property named after the question's **Name**, as set on the catalog item.

<Image src="asset:screenshots/api/scripting-records-questions/apple-iphone-questions.png" size="70">The Questions list of the Apple iPhone 16 catalog item, with the question names in the Name column.</Image>

## Questions methods

The Questions object behaves like a TableRecord. It has the TableRecord methods and these additions.

| Method | Returns | Description | Since |
| --- | --- | --- | --- |
| `<QuestionName>` | QuestionResponse | The question and its answer. | 1.11 |
| `asList()` | Array | Returns every question as a QuestionResponse, in question order. | 1.11 |
| `getField(questionName)` | QuestionResponse | Returns the question by name. | 1.11 |
| `getRelation(questionName)` | QuestionResponse | Returns a reference question by name. `relation(questionName)` is the same. | 1.11 |

## QuestionResponse methods

A QuestionResponse wraps the answer field, or the answer relation for a question that refers to records. It has the [Field or Relation](page:scripting/records/field-and-relation) methods and these additions. It also answers the fields of the question record, so `question.Name()` returns the question's name.

| Method | Returns | Description | Since |
| --- | --- | --- | --- |
| `hasAnswer()` | Boolean | Returns `true` if the question has an answer. | 1.11 |
| `answer()` | TableRecord | Returns the answer record, or `null`. | 1.11 |
| `question()` | TableRecord | Returns the question record. | 1.11 |
| `prompt()` | String | Returns the question's prompt in the current user's language. | 1.11 |
| `promptI18n()` | String | Returns the key of the question's prompt. | 1.11 |
| `value()` | Any | Returns the answer's value. For a question that refers to records, returns the records. | 1.11 |
| `displayValue()` | String | Returns the answer as the user saw it. For records, returns their display values separated by commas. | 1.11 |
| `rows()` | Array | Multi-record questions only. Returns the answer's rows, or an empty array. | 1.11 |
| `getQuestionField()` | Field | Returns the answer as a Field connected to the record. | 1.11 |

A multi-record answer is a list of rows. Each row has `id()`, `columns()`, `value(column)`, `displayValue(column)` and `isPending()`, plus `generatedRecordId()`, `transformStatus()`, `transformError()` and `isTransformed()` for the record a row generated. Rows are read-only.

## Costs

`costs()` on the record returns the catalog costs, or `null` when there are none.

| Method | Returns | Description | Since |
| --- | --- | --- | --- |
| `lineItems()` | Object | Returns the cost of each line item. | 1.11 |
| `totals()` | Object | Returns the cost totals. | 1.11 |

## Examples

### Read one answer

**Servicely Script**

```javascript
let questions = current.questions();

[questions.RequestedFor.value(), questions.RequestedFor.displayValue()];
```

**Response**

```javascript
["<record id>", "<user name>"]
```

### List the questions and prompts

**Servicely Script**

```javascript
current.questions()
    .asList()
    .map(question => question.Name());
```

**Response**

```javascript
["RequestedFor", "ShortDescription", "Description", "RequestorEmail", "RequestorPhone"]
```

Replace `question.Name()` with `question.prompt()` to get the prompts, such as "Who is the contact person for the Incident?".

### Build a map of answers

**Servicely Script**

```javascript
current.questions()
    .asList()
    .reduce((map, question) => {
        map[question.Name()] = question.displayValue();
        return map;
    }, {});
```

**Response**

```javascript
{
  "RequestedFor": "<user name>",
  "ShortDescription": "<short description>",
  "Description": "<description>",
  "RequestorEmail": "user@example.com",
  "RequestorPhone": "<phone number>"
}
```

## Related

- [TableRecord](page:scripting/records/table-record)
- [Field and Relation](page:scripting/records/field-and-relation)
- [Catalog scripting](page:admin/catalog/catalog-scripting)
- [Question fields](page:admin/catalog/question-fields)
