execute-entity
Execute-entity can save, update, or delete data in a single row from a database, depending on the chosen method. Each datasource type (Dynamic / SQL / REST) will have a different syntax for updating, saving, and deleting data.
For the Dynamic datasource, values will be saved under the data option. For SQL/REST datasource, values will be saved under the Parameters option.
This action can't be used if you are using Static Data.
Configuration options
An execute-entity action can be used in multiple areas:
Under the action button
In action list
In onPress/onChange events (if the component you are setting up has these options)
In onRefresh/onFocus
The execute-entity has a go-back option, which is set to on by default. That means when you run execute-entity, it will automatically return you to the previous jig.
Offline remote data handling
Dealing with offline remote data is fundamental to ensuring data synchronization and consistency between the mobile app and the remote data source, allowing users to continue using the app and performing actions without interruption. Offline remote data handling explains how to configure solutions to deal with data when the device is offline using the queueOperations property available in execute-entities and provides examples and code samples.
Examples and code snippets
Execute-entity in action

In this example, execute entity is used in action with the create method. This example results in creating a new record with the First name, Last name, Email, and Phone number information. Execute entity is called by the press of the Save details button on the bottom.
Example: See the full example of execute-entity in GitHub.
actions:
- children:
- type: action.execute-entity
options:
title: Save details
provider: DATA_PROVIDER_DYNAMIC
method: create
entity: default/form
data:
firstname: [email protected]
lastname: [email protected]
email: [email protected]
phone: [email protected]
onSuccess:
type: action.go-backExecute-entity in action list

By pressing the Save details button the execute-entity action will be followed by the go-to action.
Examples: See the full example of execute-entity in GitHub.
actions:
- children:
- type: action.action-list
options:
isSequential: true
title: Save details
actions:
- type: action.execute-entity
options:
provider: DATA_PROVIDER_DYNAMIC
method: create
entity: default/form
data:
firstname: [email protected]
lastname: [email protected]
email: [email protected]
phone: [email protected]
- type: action.info-modal
options:
modal:
title: Details successfully saved
buttonText: View list
element:
type: icon
icon: cog-approved
color: primary
onConfirmed:
type: action.go-to
options:
linkTo: ja-execute-entity-onPressExecute-entity in onPress/onChange event

item:
type: component.list-item
options:
title: [email protected]
subtitle: [email protected]
description: =(@ctx.current.item.modify = 0 ? 0 :@ctx.current.item.modify) & ' time/s changed.'
leftElement:
element: avatar
text: ""
uri: [email protected]
onPress:
type: action.execute-entity
options:
provider: DATA_PROVIDER_LOCAL
method: update
entity: default/employees
data:
id: [email protected]
modify: =($number(@ctx.current.item.modify) + 1)item:
type: component.list-item
options:
title: [email protected]
subtitle: [email protected]
description: =(@ctx.current.item.modify = 0 ? 0 :@ctx.current.item.modify) & ' time/s changed.'
leftElement:
element: avatar
text: ""
uri: [email protected]
rightElement:
element: checkbox
value: true
onChange:
type: action.execute-entity
options:
provider: DATA_PROVIDER_LOCAL
method: update
entity: default/employees
data:
id: [email protected]
modify: =$number(@ctx.current.item.modify) + 1Execute-entity in onRefresh/onFocus

onRefresh:
type: action.execute-entity
options:
provider: DATA_PROVIDER_DYNAMIC
method: update
entity: default/employees
data:
id: [email protected]
modify: [email protected] >= 10 ? 1 :($number(@ctx.datasources.employee-detail-dynamic.modify) + 1)onFocus:
type: action.execute-entity
options:
provider: DATA_PROVIDER_DYNAMIC
method: update
entity: default/employees
data:
id: [email protected]
modify: [email protected] >= 10 ? 1 :($number(@ctx.datasources.employee-detail-dynamic.modify) + 1)Deleting data using execute-entity
Here is an example of deleting different data using execute-entity. There are always 2 options for how you can delete a record:
Using SQL Select
Using JSONata function
In the first two examples, you can see the same situation where you are deleting all the records where the name equals Jane.
The third example shows how to delete the first 3 records from your datasource.
datasource:
people:
type: datasource.sqlite
options:
provider: DATA_PROVIDER_DYNAMIC
entities:
- entity: people
query: |
SELECT
id,
'$.name',
'$.surname',
'$.address'
FROM [people] WHERE '$.name' LIKE 'Jane'
actions:
- type: "action.execute-entity"
options:
entity: people
method: delete
provider: DATA_PROVIDER_DYNAMIC
data:
id: [email protected]type: "action.execute-entity"
options:
goBack: stay
entity: form
provider: DATA_PROVIDER_LOCAL
method: delete
data: "[email protected][name = 'Jane']{'id':id}[]"datasource:
people:
type: datasource.sqlite
options:
provider: DATA_PROVIDER_DYNAMIC
entities:
- default/people
query: |
SELECT
id,
'$.name',
'$.surname',
'$.address'
FROM [default/people] LIMIT 3
actions:
- type: "action.execute-entity"
options:
goBack: stay
entity: deafult/people
method: delete
provider: DATA_PROVIDER_DYNAMIC
data:
id: [email protected]Last updated
Was this helpful?