Skip to content

Data binding

  • data
  • sources - array of data source definitions
    • id: unique id for the data source
    • query: query to use; supports templates (required if kind is dispatch or user)
    • refresh: items to trigger refresh on; save | delete | action | latest | refresh
    • refresh: items to trigger refresh on; save | delete | action | latest
    • kind: script type, dispatch, user, script, attributes, contextDispatches; default is dispatch

Query mapping

Queries will map the following properties on the client before sending the query to the platform.

  • $user - context user for the view (or logged in user)
  • $date - context date for the view (or current date)
  • $currentUser - logged in user
  • $today - current local date

Refresh flags

  • refresh: To trigger a refresh add "refreshEvent":true to action options.
  • save, delete: triggered when a local dispatch is saved or deleted
  • action: triggered when a local dispatch action is triggered
  • latest: triggered when a org dispatch update is detected
  • user: user information changed
  • healthkit: new health data available
  • oauth2: new oauth login

Data source kinds

Dispatch

Dispatch query.

Script

Ensure to provide at least script handle in the options parameter. Past any parameters that the script required in the options parameter. You can use expression in the parameter as they will be evaluated using the context dispatch.

User

User query.

Attributes

User attribute query.

Data objects available for tempaltes and conditional expressions

Data can come from a few different places: context dispatch, root dispatch, a data source or query source, the data store.

  1. Context dispatch
  2. dispatch.{property} - dispatch properties from context dispatch
  3. values.{attribute} - attribute values from context dispatch
  4. context.values.vattribute}
  5. context.dispatch.{property}
  6. Root dispatch
    • root.values.{attribute} - root dispatch data
    • root.dispatch.{property} - root dispatch properties
  7. Data paths
    • data.{path} - data attributes; path is fully qualified and can include array indexes
  8. User paths
    • user.{property} - attributes from context user
  9. Data source access
    • $source.{data source name}[index?] - access data
    • $source.{data source name}{path} - access data
    • $source.{data source name}{path}[{path}] - access data
  10. Profile paths
    • profile.{property} - attributes from session user
  11. Configuration
    • config.{property} - configuration

Additional properties available for conditional expressions

  1. Property values; data available based on the context
  2. props.{path} - properties available to the conditional based on the component context

Some examples

{data.task.shout.subtitle}: will get the data available in the context, usually passed in {$source.status.count}: get the count property on the ID=status data source {$source.status.variants[data.variant].count}: get the object available on ID=status data source and then resolve the path data.variant seperately and use that as a dynamic path

Inbox object properties

Inbox data is available on data.inbox with the following attributes:

  1. id - inbox entry id
  2. name - name
  3. title - title
  4. description
  5. createdAt
  6. nameStyle -
  7. stepBody - json object for the current step
  8. initialPayload - json object for the initial payload data
  9. step
  10. state
  11. status

Dispatch properties

Special properties

  • attachmentCount
  • hasAttachment
  • firstAttachmentUrl
  • firstAttachmentPreview
  • blocks with index

Direct properties

Other properties are available on dispatches based on the Dispatch object.

Dispatch example

  "data": {
    "sources": [
      {
        "id": "creatorStatus",
        "query": "current user, given service [creator-status]",
        "refresh": []
      }
    ]
  }

Script example

Assume that the script returned

{
  "message": "hello world"
}
{
  "data": {
    "sources": [
      {
        "id": "pastActions",
        "kind": "script",
        "options": {
          "handle": "task-past-actions",
          "startDate": "2022-09-27",
          "date": "{#now | date:YYYY-MM-DD}"
        }
      }
    ]
  },
  "ux": {
    "component": "text",
    "text": "{$source.pastActions.data.message}"
  }
}

User example