- 14 Feb 2022
- 3 Minutes to read
- Print
- DarkLight
Entity Extension CRUD Actions
- Updated on 14 Feb 2022
- 3 Minutes to read
- Print
- DarkLight
Overview
An Entity Extension Data Structure extends the data stored in Decisions for an existing Entity Data Structure (e.g. a "Person" Entity with an "Address" extension). The following article will demonstrate how to use the Create, Update, and Delete steps in a Flow using an Entity Extension Data Structure tied to a previously created Entity Data Structure.
Example
For this tutorial, the Entity Extension Data Structure is tied to an Entity Structure created with the following fields:
EntityPerson | |
Firstname | String |
Lastname | String |
DOB | Date time |
Entity Extension
After the Entity Structure was created, an Entity Extension with the following fields was created and tied to the previously created Entity:
AdditionalPersonInfo | |
SSN | String |
Employed | Boolean |
Address | String |
Create
To create an Entity that contains an Entity Extension
- To begin, navigate to a Designer Folder and select CREATE FLOW from the Global Action Bar.
- In the resulting Create Flow dialog, select and name the default Flow [EE Flow]. Click CREATE to open the Flow Designer.
- In the Flow Designer, navigate to the Toolbox > USER DEFINED TYPES > ENTITY EXTENSIONS > ADDITIONALPERSONINFO_ENITITYPERSON category and drag a Create AdditionalPersonInfo step to the workspace and connect it to the Results outcome of a Fetch Entities step.
- Connect the No Results outcome to the End step.
- In the Properties panel of the Create AdditionalPersonInfo_EntityPerson step, navigate to the INPUTS > Item to Create field and change the input mapping from Unknown to Build Data.
- Notice the appearance of new inputs and locate the AdditionalPersonInfo input and change its input mapping to Build Data.
- In its expansion, locate the Address, Employed, and SSN fields and change the input mappings from Ignore to Constant. In this example, the input values are as follows: Address: 123 Example Dr, Employed: checked boolean, and SSN: 123-45-6789.
- Next, navigate to INPUTS > Entity Person and change the input mapping from Ignore to Select From Flow.
- In the resulting Pick Data For Input: EntityPerson dialog, select Entity Results, then drill down to First.
- Select Debug from the Top Action Panel, doing so will save the Flow and open the Debugger. Decisions will add the Entity Extension properties to the selected Entity object.
Update
To update an existing record in an Entity Extension Data Structure, the Edit AdditionalPersonInfo step is used. This step is found in the Toolbox > USER DEFINED TYPES > ENTITY EXTENSIONS > ADDITIONALPERSONINFO_ENTITYPERSON category and will change every data field even if the user changes only one data field. In order to change any record in a Data Structure, the Fetch Entities step is necessary to locate a record and pass it into the Edit step.
Edit AdditionalPersonInfo step
Delete
For Entity Extensions, there are no Delete steps in the Toolbox > USER DEFINED TYPES > ENTITY EXTENSIONS > ADDITIONALPERSONINFO_ENTITYPERSON category. In order to remove a record from an Entity Extension, the Edit AdditionalPersonInfo_EntityPerson step will be used again.
- To delete a record, drag an Edit AdditionalPersonInfo_EntityPerson step to the workspace and connect it to the Results outcome of the Fetch Entities step. The No Results outcome should be connected to the End step, as seen above.
- With the Edit AdditionalPersonInfo_EntityPerson step selected, navigate to the Properties panel > Item to Create and change the input mapping to Build Data. Leave the new inputs with Ignore mappings; this will remove additional values that were tied to the original Entity Data Structure.
- Next, navigate to INPUTS > EntityPerson and change its input mapping to Select From Flow.
- Select EntityResults from the output Fetch Entity step, then drill down to First. This will complete the steps necessary to delete a record from an Entity Extension Data Structure.