- 26 Jun 2024
- 3 Minutes to read
- Print
- DarkLight
External Entity CRUD Actions
- Updated on 26 Jun 2024
- 3 Minutes to read
- Print
- DarkLight
Overview
An External Entity accepts data not stored in Decisions to create a Data Structure used similarly to an internal Data Structure. The External data may also build actions within a Configuration Folder similar to its internal counterparts.
An External Entity's Configuration Folder is home to Flows that power the External Entity. Users must create these Flows and until they are complete an External Entity has limited functionality. After those Flows have been configured users will have access to CRUD actions. This article demonstrates how to use the Create, Update, and Delete steps with an External Entity Data Structure once configuration is complete..
Example
Before continuing with this example, a Database integration must be created.
Person | |
Column Values | DataType |
PersonID | Varchar(255) |
Firstname | Varchar(255) |
Lastname | Varchar(255) |
DOB | Date |
To quickly create the table and values, copy and paste the following SQL commands into SQL Server Management Studio; these commands will create the table and its test values.
CREATE TABLE Person (PersonID varchar(255), Firstname varchar(255), Lastname varchar(255), DOB date);
insert into dbo.Person (PersonID, Firstname, Lastname, DOB)
values ('8ce8be77-fe28-43ef-8b96-4c3743192a0e', 'Jill', 'Doe', '2021-10-30');
insert into dbo.Person (PersonID, Firstname, Lastname, DOB)
values ('f048a932-4619-4b8e-8b94-79450b59af9c', 'Jake', 'Doe', '2021-10-25');
insert into dbo.Person (PersonID, Firstname, Lastname, DOB)
values ('cf80321e-6c6c-4e66-867e-ec24d710df39', 'Blake', 'Doe', '2021-10-17');
Create External Entity Data Structure
The final part of the setup is to create an External Entities Decisions Data Structure. It will have fields similar to the external database table.
Person | |
Data Field | DataType |
PersonID | String |
Firstname | String |
Lastname | String |
DOB | DateTime |
Once created, the Configuration Folder for External Entities will come with default CRUD action Flows inside the folder. These Flows are not pre-configured and will need to be designed. See Creating External Entities for more about how to configure those Flows.
Create
To create a record in the Person External Entity Data Structure.
- Create a new Flow. Do not use the Flow in the External Entity Configuration Folder.
- In the Flow Designer, navigate to the Toolbox > USER DEFINED TYPES > EXTERNAL ENTITIES > PERSON category and drag a Save [Person] step to the workspace and connect it to the Start step and End step.
- With the Save [Person] step selected, navigate to Properties > INPUTS > Entity field and change the input mapping to Build Data.
- Notice the expansion of input values. For each input (DOB, Firstname, Lastname, PersonID), set the input mapping to Constant, and fill the fields with example information.
- Select Debug from the Top Action Bar; the Flow now creates the record in the Person External Entity Structure. No Auto-ID GenerationNotice that the PersonID was not automatically created when the Flow was run because External Entities are stored outside of Decisions.
Update
The Save and Get All steps are necessary to update an existing record in an External Entity Structure. The Save [Person] step changes a record's data in an existing Data Structure, while the Get All [Person] step retrieves the data and records to operate the Save [Person] step.
All fields of the Entity must be filled with information, even those that remain unchanged. Leaving a blank value in a field saves a Null value for that field.
Save [Person] step
- Drag and connect a Get All [Person] step to the Start step.
- Drag and connect a Save [Person] step to the Get All [Person] step. Connect this step to the End step.
- With the Save [Person] step selected, navigate to Properties > INPUTS > Entity and change the input mapping to Build Data.
- Notice the expansion of input values. Change the input mapping to Constant for each new input (DOB, Firstname, Lastname, PersonID), and fill the value fields with example information.
- Select Debug from the Top Action Bar; this Flow now edits the record with the specific data.
Delete
Use the Delete [Person] and Get All [Person] steps to remove records from the External Entity Data Structure. The Delete [Person] step deletes the specified Entity record from the Data Structure.
- Drag and connect a Get All [Person] step to the Start step.
- Drag and connect a Delete [Person] step to the Get All [Person] step. Connect this step to the End step.
- With the Delete [Person] step selected, navigate to the Properties> INPUTS > Entity field and change the input mapping to Select From Flow.
- In the resulting window, select Entities, then drill down to Last.