- 22 Nov 2022
- 3 Minutes to read
- Print
- DarkLight
External Entity CRUD Actions
- Updated on 22 Nov 2022
- 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.
External Entities shine in use cases where an external database or structure cannot be migrated into a different environment, and users want Portal visible actions on the data.
Inside the Configuration Folder, a list of Flows displays different potential actions in the Designer View. The External Entity's capabilities are limited until these Flows are built. This article demonstrates how to use the Create, Update, and Delete steps with an External Entity Data Structure to build these Flows and their respective actions.
Example
For this tutorial, a Database was integrated with a table named 'Person', including the following fields:
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, all step logic for the External Entity's actions are found within Toolbox > USER DEFINED TYPES > EXTERNAL ENTITIES > [ExternalEntityName].
Create
To create a record in the Person External Entity Data Structure
- In a Designer Folder, create a Flow. It will automatically open in the Flow Designer.
- 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 the Properties panel > INPUTS > Entity field and change the input mapping to Build Data.
- Notice the expansion of inputs 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; this will save the Flow and start the Debugger. 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
To update an existing record in an External Entity Structure, the Save and Get All steps are necessary. 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 inputs values. For each new input (DOB, Firstname, Lastname, PersonID) change the input mapping to Constant, and fill the value fields with example information.
- Select Debug from the Top Action Bar; this will save the Flow and start the Debugger. This Flow now edits the record with the specific data.
Delete
To remove records from the External Entity Data Structure, use the Delete [Person] and Get All [Person] steps. 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.