This article provides guidance on how to use the Write to Data Store Entity smart service in the process modeler. The Write to Data Store Entity smart service is a powerful tool that allows you to easily insert or update data in your database from Appian.
The Write to Data Store Entity Smart Service adds process data to an entity in a Data Store. It allows you to select a single entity in a data store to save or update data.
You must create a node input with the same custom data type (CDT) as the entity in the data store that you select. The way you define your custom data type determines whether you can update existing records in the data store. You must also designate a field in the CDT as your record ID (primary key) and specify an existing value, or the data written is always inserted as a new record.
When the activity is attended, you can select the element or sub-element of a custom data type to store form-data in your configuration of the interface. Data written to a data store using this activity must be supported in the XML 1.0 standard.
Note: Unicode control characters – such as characters #x0 and #x1 through #x1F – are not fully supported in XML 1.0.
Any update on related data is based on the JPA annotations/DB schema defined for the entity. For example, updating the parent in a one-to-many containment relationship also affects the children, but updating one side of a lookup relationship will not affect the related object.
Also note that any CDT created through the Data Type Designer or uploaded via an XSD file has the
cascade attribute set to
ALL on the child CDT by default, so unless you have manually changed this setting, updating a parent CDT value with this setting also affects the child value.
See also: CDT Relationships
The user executing this activity must have Viewer rights to the selected data store, in order to update or insert information.
NOTE: Since the Write to Data Store Entity Smart Service works directly with your data store and custom data types, be sure to note the Schema Design Best Practices before implementing this smart service.
Category: Data Services (Integration Services)
Assignment Options - Attended
See also: Smart Services
This section contains tab configuration details specific to this smart service. For more information about common configurations see the Process Node Properties page.
|Data Store Entity||Data Store Entity||The data store entity where you want to save your form data.||No||Yes|
See also: Data Store Entity
Updating an Existing Value
The data that you write can update an existing record when a primary key is properly configured for the entity and provided by your node input.
Saving a New Value
Saving a new value for an existing record does not merge the records, the old record is overwritten.
Given the following record in your data store:
1 2 3 4 Person - Id = 1 - Name = "John" - Email = "email@example.com"
If you pass the following data to the data store…
1 2 3 4 Person - Id = 1 - Name = "John Doe" - Email = ""
The result is that your record is changed to list a blank Email field and an updated Name field.
To save form field values, you must create a new node input.
If the EntityData input contains a null or empty data field value, the EntityData object still returns as part of the EntityData output array with the null or empty data field.
|Name||System Data Type||Description|
|Stored Values||Any Type||The data successfully updated or stored in the database.|
You can create a new Process Variable to store the result or select an existing Process Variable from the available list.
a!writeToDataStoreEntity(dataStoreEntity, valueToStore, onSuccess, onError)
a!httpResponse(). The following function variable is available when configuring this input:
Review Schema Design Best Practices
Since this smart service works directly with your data store and custom data types, be sure to note the Database Schema Best Practices before implementing.
On This Page