Creating, Editing and Deleting Folder Entities with the Flow Designer
  • Updated on 09 May 2013
  • 5 minutes to read
  • Print
  • Dark
    Light

Creating, Editing and Deleting Folder Entities with the Flow Designer

  • Print
  • Dark
    Light

By default, folder entities have pre-configured steps for creating, editing and deleting those entities from within a flow. These steps can be found in the Toolbox tab, under the category Integration > Folder Entity Data Structures > [MyFolderEntity] .

Example

In our example, we will create a flow that uses the default folder entity steps to edit, delete and create a new folder entity.
Prior to this example, we have created a folder extension type called "Car." Within each Car exist a number of CarPassenger folder entities. Each VehiclePassenger has three properties: First name, last name and seat position.
Our new flow will be an action of the Car folder extension and will be called "Add Driver." When we run this flow, the user will fill out a form containing the new driver's first name and last name. On submission, our flow will move any car passenger currently in the driver's seat to the back seat. If the car has four or more car passengers, it will delete the fourth passenger in the car. Finally, our flow will create the new car passenger and place them in the driver's seat.
Our example also assumes that the Add Driver Form has already been designed.
formPreview13.png

We will begin creating our flow by navigating to the behavior action folder of our Car folder extension at System > Common Data Elements > Folder Behavior Actions > Transportation.CarFolderBehavior . We will click the Create Flow button.

2018-07-05_162010.jpg

In the resulting New Flow pop-up, we will name this flow "Add Driver" and click OK to open it in the Flow Designer.
2018-02-13_152907.png

We will begin by retrieving all VehiclePassenger entities from this folder. We will find the Fetch All VehiclePassenger By Folder Id component in the Flow Designer start-up window, under the category Integrations > My Integrations > User Defined Types > Entities > Passengers
2018-07-05_160110-1.jpg

We will map the FolderId flow input to Entity Folder Id and rename the output to "CarPassengers".
2018-07-05_131758.jpg

Next, we will place the form with which we'll add our new car passenger. We will find it in the Toolbox tab, under the category Forms [Interaction] > [Root Folder] > Designer Entities .
Then, we will iterate through each of our car passengers and, if we find one seated in the driver's seat, move it to the back seat. We will find the ForEach Step component in the Toolbox tab, under the category Flow Management .

2018-02-13_154543-2.jpg

Under the Collection section, we will open the Type selector and select a data type of "CarPassengerIntermediate", then click OK .
2018-07-05_132224.jpg

After defining the type of the ForEach Step , we must map the source of the CarPassengers through which it will iterate. Under the Inputs > Collection section, we will open the Type selector and select the CarPassengers collection that was outputted from the Get All VehiclePassenger By Folder Id component. Each item outputted by the ForEach Step 's Next outcome will be called "CarPassenger Item".
2018-07-05_132025-1.jpg

Next, we will test whether the car passenger outputted by the ForEach Step component is in the driver's seat. We will find the Equals String Case Sensitive component in the Toolbox tab, under the category Data > Text .

6-3.png

For the Equals String Case Sensitive component, we will set caseInsensitive to True and define value2 as "Driver's Seat". We will set value1 to CarPassenger Item.SeatPosition.
2018-07-05_132816.jpg

If a car passenger is seated in the driver's seat, we would like to move that car passenger to the back seat. We will find the Edit CarPassenger component in the Toolbox tab, under the category Integration > Folder Entity Data Structures > CarPassenger .
2018-07-05_132918.jpg

In the Mapping Editor, we will first define Seat Position as "Back Seat".
2018-07-05_133352.jpg

Next, we will preserve the properties of the CarPassenger we are editing by mapping them directly - with three exceptions.
Because they are generated automatically by the system, we will leave the mapping type of ModifiedDate , ModifiedBy and ExtensionData set to "Ignore".

2018-07-05_133710.jpg

If a CarPassenger is not in the driver's seat, we don't need to modify it, so we will connect the False outcome from Equals String Case Sensitive 1 back to ForEach Step 1 . We will also connect the Edit CarPassenger step's Done outcome back to ForEach Step 1 .
2018-07-05_133842.jpg

Once we've updated the seating positions of our car passengers, we would like to test whether there are four or more car passengers in our Car already, and whether we need to make room for our new driver. We will find the Greater Than Or Equal To component in the Toolbox tab, under the category Data > Numbers .
2018-07-05_134013.jpg

To compare the number of passengers to our maximum number, we will map value1 to CarPassengers.Count and value2 to "4".
2018-07-05_135840.jpg

If there four or more passengers, we would like to delete the last car passenger in our list. We will find the Delete CarPassenger component in the Toolbox tab, under the category Integration > Folder Entity Data Structures > CarPassenger .
2018-07-05_140023.jpg

To delete the last car passenger in our list, we will map CarPassengers.Last.ID to Id .
2018-07-05_141041.jpg

Finally, we will create our new car passenger and place them in the driver's seat. We will find the Create CarPassenger component in the Toolbox tab, under the category Integration > Folder Entity Data Structures > CarPassenger .
2018-07-05_141153.jpg

When creating a new folder entity, not all properties are required, so we will define only the ones that are. We will map FolderId to our entity's FolderId property and its EntityFolderID property. The FolderId property is required so the entity knows its destination; this value can never be null (and will not be in this scenario). We will define the Seat Position as "Driver's Seat" and map FirstName and LastName to the appropriate fields.
2018-07-05_141726.jpg

For the EntityName property, we will use the Text Merge Plain mapping to combine FirstName and LastName into a single value, then finish by clicking OK and closing the Mapping Editor.
2018-07-05_141802.jpg

After connecting our remaining flow outcomes, our flow will be complete, so we will save it and close the Flow Designer.
2018-07-05_141834.jpg

When we navigate to our example Car folder, we will see it contains four CarPassenger entities: Anthony Young in the Driver's Seat and three others (Daniel Winters, Jenny Abma and Abby Foster) in the back seat.
To add a new driver, we will select the Add Driver action from our Car folder.
2018-07-05_162217-2.jpg

In the resulting pop-up form name the driver
2018-07-05_162341.jpg

2018-07-05_164436.jpg

Was this article helpful?