- 06 Jun 2022
- 1 Minute to read
- Print
- DarkLight
Entity Structure CRUD Actions
- Updated on 06 Jun 2022
- 1 Minute to read
- Print
- DarkLight
Overview
This article will demonstrate performing Create, Read, Update, and Delete (CRUD) actions, via Flow steps, on Entities.
Preparation
Create an Entity Data Structure with with applicable attributes, such as the Person example below:
Person | |
Firstname | String |
Lastname | String |
DOB | Date time |
Since Data Structure Entities are saved in Decisions, users will have to create a Normal Folder to store the created Entities. For this example, create a normal folder and call it "Person Entity Data Folder."
Create
To create a record in the Person Entity Data Structure:
- Create a Flow.
- Expand the User Defined Types category
- Expand the Entities category.
- Expand the Person datatype.
- Drag the Create Person step onto the Flow canvas.
- Connect it to the Start and End steps.
- Set Folder Id to a constant value, and Pick the Person Entity Data Folder.
- On the Item To Create input, change Unknown to Build Data.
- Set constant values for Name, Firstname, Lastname, and DOB.
- Click the Debug button to run the Flow; the record in the Person Entity Structure has been created.
- To view the record, navigate to the Person Entity Data Folder.
Update
The Edit Person and Selective Update Person steps may be used to update an existing record in the Person Entity Structure; recall, these steps are nested in the Flow Steps panel under User Defined Types > Entities > Person.
'Edit Person' Step
- Edit Person step- changes ALL data fields, even if only 1 is specified
- updates the specified data field(s) to the provided parameter(s)
- overwrites non-specified parameter(s) to NULL (or Empty)
- Selective Update Person step - only changes the data field(s) specified
- updates the specified data field(s) to the provided parameter(s)
- ignores non-specified parameter(s), leaving existing data in tact
'Selective Update Person' Step
Delete
To remove a record from the Person Entity Structure, use the Delete Person step, found nested under User Defined Types > Entities > Person in the Flow Steps panel. Once the required Id is provided as step Input, running the Flow will delete the record from the database associated with that Id.