--- title: "Using a Flow to Create Dynamic Objects at Runtime" slug: "using-a-flow-to-create-dynamic-objects-at-runtime" updated: 2021-12-03T16:36:14Z published: 2021-12-03T16:36:14Z canonical: "documentation.decisions.com/using-a-flow-to-create-dynamic-objects-at-runtime" --- > ## Documentation Index > Fetch the complete documentation index at: https://documentation.decisions.com/llms.txt > Use this file to discover all available pages before exploring further. # Using a Flow to Create Dynamic Objects at Runtime Example Lab ArticleWhile Example Lab projects are resources for public use, articles and assets are not actively maintained. Screenshots and features are from the specified version below. These references may become dated as new versions are released. --- ## Overview | ## Example Lab Details | | --- | | **Version** | 7.8.0.6420 | | **Root Folder** | DynamicObjectCreation | | **Modules** | None | | **Dependencies** | Five: BuildXMLString [Flow], History Folder of Main Process Folder, Adjust Data Flow [Flow], Object [System], FetchRandomDynamicData [Flow] | This Example Lab demonstrates how to create Dynamic Objects at Runtime through the use of a Flow. --- ## Explanation The following example utilizes a three **Sub** **Flow** system to dynamically create **Decisions** **Objects** at **Runtime** that can be then **Serialized** into an **XML** **String**. These serialized Objects can then be used by a third-party application for additional functionality. Note on ExampleBefore proceeding to the **Main** **Flow**, open and run the **Populate** **Mock** **DB** **Data** to create some sample data for use by the Main Flow. ![](https://cdn.document360.io/6ef8bcc1-6489-4486-9ad1-83acff7e5df0/Images/Documentation/2021-12-03_11h16_58.png) The Flow achieves this by utilizing a **Create** **Data** step to create an **Object List (DynamicListBuilder)**; this serves as the Object generated by the Flow. The Flow then generates a **Random** **Integer** to determine which **List** of **Employee** information (**Person**, **Document**, and **Employee** data) is **Fetched**. The data for this Object is then iterated through a **ForEach** **Step** loop that assigns a Random First Name for each Object (via **Adjust Data Flow**). Lastly, the DynamicListBuilder data is sent through a ForEach Step loop that casts the Object data to their respective **Data** **Types**, each one of which is sent to a separate **XML** **Serialize** step to convert them into XML values. These values are cleaned up through the use of **Replace** **Text** steps for final use with the **Close** **String** **Builder** steps; these steps are used to compile the XML values into a single **String** for final **Output**. Reference Articles[Serialization](https://documentation.decisions.com/docs/serialization) [Creating and Using a Case Entity Data Structure](https://documentation.decisions.com/docs/case-entity-data-structure) [Processing Lists of Items using ForEach Step](https://documentation.decisions.com/docs/processing-lists-of-items-with-the-foreach-step) ![](https://cdn.document360.io/6ef8bcc1-6489-4486-9ad1-83acff7e5df0/Images/Documentation/2021-12-03_10h44_27.png)![](https://cdn.document360.io/6ef8bcc1-6489-4486-9ad1-83acff7e5df0/Images/Documentation/2021-12-03_11h14_19.png)![](https://cdn.document360.io/6ef8bcc1-6489-4486-9ad1-83acff7e5df0/Images/Documentation/2021-12-03_11h13_29.png)![](https://cdn.document360.io/6ef8bcc1-6489-4486-9ad1-83acff7e5df0/Images/Documentation/2021-12-03_11h16_20.png) --- ## Project Download The examples attached were developed to be instructional and were not developed as officially supported components. For more information or to engage our service team to develop fully supported, production quality solutions, please contact services@decisions.com. Import the project below to a Decisions environment on version 7.8.0.6420 or later using our [Importing/Exporting](https://documentation.decisions.com/docs/exporting-and-importing-overview) article. [ExampleLab[DynamicObjectCreationToXMLOut]-02122021-113340.zip](https://cdn.document360.io/6ef8bcc1-6489-4486-9ad1-83acff7e5df0/Images/Documentation/ExampleLab%5BDynamicObjectCreationToXMLOut%5D-02122021-113340.zip) ---