How to Write to Data Store Entity in Appian ?

Rochisha Jaiswal
4 min readFeb 21, 2022

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.

Steps to follow to setup Data Store Entity—

Assumption: You have already created a Data Type and it is saved in your application’s Data Store (as a Data Store Entity). You typically cannot write to the database from Appian without first creating a Data Type (a Data Store Entity).

Inside the Write to Data Store Entity node, click into Data > Inputs > Data Store Entity > Browse (magnifying glass):

In the Choose an Entity dialog, find your application’s Data Store, and then click into it:

Now, find your Data Type, then click Select, and then OK:

Click New Input:

Click on the input that was just created (in this case, Param3):

Click Browse (magnifying glass):

Find your Data Type, then click Select next to your Data Type, and OK:

At this point, you have three options:

  1. If you want to draft the row to be written field by field, click the + sign on the left, then edit each field
  2. If you already have the data to be written saved into a process variable, use the ▼ button, and it will appear as a recommendation, assuming the process variable is of the correct type
  3. If you would like to draft the row to be written inside an expression, use the blue Edit icon (pencil)

Write Multiple Rows to a Data Store Entity

If you would like to write more than one row to the Data Store Entity at once, click Multiple:

Note that if you are using a process variable to do so, that process variable must be configured as multiple as well, under File > Properties > Variables > (Select your variable) > Multiple (Variable can store multiple values). If not properly configured, you may find that only a single row is written to the database.

Save the ID of the written row back to the Process Variable

If you would like to write the identifier of the written row back into the process variable, you can use the Stored Values option, under Outputs > Results > Stored Values.

Under Target:

  • You can use the +V icon to automatically create a new process variable to save this data
  • Or (recommended), you can save it back into the same variable that you were using (pv!TST_timesheetLog in the example above) by pressing ▼

This will make it so that if you were writing a process variable to the database, such as:

{id: NULL, name: “Adam”}

This option would save the identifier back into a process variable, such as:

{id: 12, name: “Adam”}

Where “12” would be the identifier of the new row written to the database.

Congrats, you have learned how to Configure Data Store Entity to easily insert or update data in your database from Appian!

Dear reader, I hope this was clear and useful. If you found it interesting don’t forget to like this article and follow me to be notified about similar ones in future. See ya! :)

--

--