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 isdispatch
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 deletedaction
: triggered when a local dispatch action is triggeredlatest
: triggered when a org dispatch update is detecteduser
: user information changedhealthkit
: new health data availableoauth2
: 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.
- Context dispatch
dispatch.{property}
- dispatch properties from context dispatchvalues.{attribute}
- attribute values from context dispatchcontext.values.vattribute}
context.dispatch.{property}
- Root dispatch
root.values.{attribute}
- root dispatch dataroot.dispatch.{property}
- root dispatch properties
- Data paths
data.{path}
- data attributes; path is fully qualified and can include array indexes
- User paths
user.{property}
- attributes from context user
- 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
- Profile paths
profile.{property}
- attributes from session user
- Configuration
config.{property}
- configuration
Additional properties available for conditional expressions
- Property values; data available based on the context
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:
id
- inbox entry idname
- nametitle
- titledescription
createdAt
nameStyle
-stepBody
- json object for the current stepinitialPayload
- json object for the initial payload datastep
state
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}"
}
}