Skip to main content

Surveys (YAML)

A survey is a form — the way Cotalker captures structured data from people. Surveys are usually the first resource partners learn to manage with cotctl, because they're self-contained and immediately useful. This page explains the YAML structure so you can author and version them confidently.

The shape of a survey

At its simplest, a survey is a code, a name, and a list of questions:

kind: Survey
code: registro_empleado
name: "Employee Registration"
questions:
- type: textinput
identifier: re_nombre
label: "Name"

Root fields

FieldRequiredDescription
kindYesAlways Survey
codeYesUnique per company. Lowercase letters, numbers, underscores. Immutable after creation
nameYesDisplay name
isActiveNoDefaults to true

code is immutable. Once a survey is created, its code can't change — choose it carefully. The same is true of each question's identifier. To "rename" either, you create a new resource. This is why we recommend a clear naming convention from the start.

Beyond these, surveys support many optional fields for who can respond, post-submission editing, conditional visibility, scoring, and binding answers to task fields. You'll reach for those as projects demand; this page focuses on the structure you'll use every day.

Questions

questions is an array, and every question shares a common set of fields regardless of its type:

FieldRequiredDescription
typeYesThe question type (see below)
identifierYesCompany-wide unique ID
labelYesThe visible label
helpNoSecondary help text
requiredNoDefaults to false
isReadOnlyNoDefaults to false

Identifiers: the one rule to internalize

A question's identifier must be unique across the entire company, not just within this survey. The convention that keeps you out of trouble is to prefix every identifier with the survey code:

# GOOD — prefixed, won't collide
identifier: re_nombre

# BAD — generic, will collide with other surveys
identifier: nombre

A few words are reserved and can't be used as identifiers: survey, user, channel, _id, UUID, target, properties.

Question types

Cotalker offers a rich set of question types. Here's the catalog — pick the one that matches the data you're capturing:

TypeFor
textStatic text, titles, separators
textinputFree text
textnumberNumbers, integers, ratings
listquestionSingle/multiple choice (radio/checkbox)
propertySelecting from a data-model property
personSelecting a person
apiSelecting from an external API
datetimeDate and time
gpsA location
imageA photo or image
fileA file attachment
signatureA digital signature
surveyAn embedded sub-survey

A couple of types have required sub-fields worth remembering: listquestion needs a non-empty options list, and property needs a filters block:

- type: listquestion
identifier: re_cargo
label: "Role"
options:
- label: "Analyst"
value: "analista"

- type: property
identifier: re_area
label: "Area"
filters:
- propertyType: "area"
subfilter: "*"

Editing surveys safely

Because apply matches questions by identifier rather than position, you can add, edit, remove, and reorder questions freely — IDs are preserved. Removing a question deactivates it (it isn't hard-deleted), and you'll be asked to confirm. If you apply a survey YAML without its questions section, the existing questions are left untouched.

A practical tip

The fastest way to learn the full structure is to export a real survey and read it:

cotctl surveys export <some_survey> -c acme -o example.yaml

See also

  • apply — how surveys are created and updated
  • Export & import — the export options, including --extract-scripts
  • Workflows — surveys are referenced by workflow transitions