Cheat Sheet

On this page you’ll find a cheat sheet to support designing documents.

Document definition

document-definition:
  name: sample-document
  types:
  - id: address
    base-type: fieldset
    fields:
    - id: street
      type: fieldset
      fields:
      - id: name
        type: string
      - id: house-nr
        type: number
    - id: zip-code
      type: number(short)
  content:
    - id: active
      type: boolean

    - id: name
      type: string
      validators:
      - required
    - id: motivation
      type: text
    - id: hobbies
      type: string[]
      possible-values:
      - hockey
      - basketball
      - polo
      - cycling
      - running

    - id: delivery-address
      type: address
    - id: facturation-address
      type: address
      messages:
        tooltip: Only required if it is different from the delivery address
    - id: company-address
      type: address
      messages:
        description: Enter the address of your workspace

    - id: date-of-birth
      type: date
      messages:
       placeholder: Enter your date of birth
    - id: alarm-activates-at
      label: Alarm
      type: time
      messages:
        help: The alarm will activate at the specified hour
    - id: reviewed-at
      type: datetime

    - id: price
      type: currency(EUR,2)
    - id: tax
      type: percentage(100)
    - id: price-including-tax
      type: currency(EUR,2)
      formula: $(price) * (1 + $(tax))
    - id: olympic-year-locations
      type: number[]
      - 2014: 'Sochi (2014)'
      - 2016: 'Rio de Janeiro (2016)'
      - 2018: 'Pyeongchang (2018)'

    - id: mentors
      type: '@user[]'
      options-query: 'deleted = false'
      validators:
      - required
      messages:
        validation.required: Atleast one mentor must be assigned

    - id: is-sportive
      label: Sportive
      type: boolean
      formula: 'isNotEmpty($(hobbies))'

    - id: employees
      type: '@user[]'

    - id: company-information
      type: fieldset
      fields:
      - id: name
        type: string
      - id: amount-of-employees
        type: number
        formula: count($(employees)
      - id: phone-number
        type: string

    - id: application
      type: document(hr:applications)

See the reference documentation for more information on configuring a document definition:

View definition

view-definition: # root key
  name: listView
  type: list # type of view this definition can affect
  properties:
    - "document.name"
    - "document.created"
    - "document.createdAt"
    - "document.createdBy"
    - "document.lastModified"
    - "document.lastModifiedAt"
    - "document.lastModifiedBy"
    - "versionLabel"
    - "field:name"
    - "field:address.street"

  filter:
    mode:
      basic: false
      advanced: true

    defaultSelector: SINGLE
    defaultQuery: "field:company like 'google'"
    basePredicate: "user.userDirectory != 1"

    fields:
      - id: field:name
      - id: field:company
        selector: MULTI
      - id: documeny.createdBy
        operand: ilike
      - id: field:mentor
        selector: MULTI
        operand: in

See the reference documentation for more information on configuring a view definition: