Questions
Methods of the Questions and QuestionResponse objects, which read the catalog questions and answers of a record in server scripts.
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. It returns null when the record has no questions, so test with hasQuestions() first if you are not sure.
if (current.hasQuestions()) {
let questions = current.questions();
}
Each question is a property named after the question’s Name, as set on the catalog item.

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 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
let questions = current.questions();
[questions.RequestedFor.value(), questions.RequestedFor.displayValue()];
Response
["<record id>", "<user name>"]
List the questions and prompts
Servicely Script
current.questions()
.asList()
.map(question => question.Name());
Response
["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
current.questions()
.asList()
.reduce((map, question) => {
map[question.Name()] = question.displayValue();
return map;
}, {});
Response
{
"RequestedFor": "<user name>",
"ShortDescription": "<short description>",
"Description": "<description>",
"RequestorEmail": "user@example.com",
"RequestorPhone": "<phone number>"
}