--- tags: - System Tasks alias: user-guide-system-tasks-transaction description: "The Transaction module defines tasks like Execution Action, Message Bus, and Service Call, configurable with settings for data retrieval and" --- # Transaction The Transaction Tasks can be categorized as Execution Action, Message Bus, or Service Call. Each type is further explained in the sections below. ## Execution Action The Execution Action Task provides a simple way to execute a DEE Action. To configure an Execution Action, you need to provide a name and, optionally, a description. Additionally, you can customize its behavior by adjusting the following settings: * **Auto Refresh** - When enabled, the page will automatically update its data at defined intervals. You can set the specific interval according to your needs. The default setting is `false`. * **Retrieve Data on Start** - When enabled, the system will fetch and display relevant data as soon as the page loads. The default setting is `true`. * **Retrieve Data on Changes** - When enabled, the system will update the data displayed whenever there are changes. The default setting is `true`. * **DEE Action** - Specifies which DEE Action in the MES system to use. ![Execution Action Task](images/uipage_transaction_execute_action.png) For some DEE Actions, you will need to specify inputs, outputs, or both. The fields you need to configure are: * **Name** - This field must be unique to each input or output. * **Friendly Name** - You can provide a more user-friendly name for the input or output. This name will be displayed in place of the technical name, making it easier for users to understand its purpose. * **Type** - Choose the appropriate data type for the input or output. There are several available types, including Boolean, DataGroup, EntityType, Integer, JSON, StateModel, String, among others. * **Collection type** - Specify the collection type if the input or output is not a single value. The options are: Array, Map, or None. * **Default value** - You can define a default value that will be used if no specific value is provided, ensuring the correct execution of the DEE Action. === "Inputs" ![Execution Action Task Inputs](images/uipage_transaction_execute_action_inputs.png) === "Outputs" ![Execution Action Task Outputs](images/uipage_transaction_execute_action_outputs.png) If the input or output Type is `ReferenceType`, and it is one of the following: `EntityType`, `File`, `Lookup Table`, `Lookup Value`, `Query`, `Role`, `State Model`, or `User`, you have the option to create a new instance of this value using the **New instance** toggle button. ![Execution Action Task reference type](images/uipage_transaction_execute_action_referencetype.png) It is possible to pass DEE Inputs and Outputs directly as a dictionary. However, any input defined by the user overrides the values defined in the Input map. For example, if you provide an input whose name matches a key in the Input map, that value will replace the existing one in the map - even if the provided value is `null`. ![DEE Inputs/Outputs](images/dee_inputs_outputs.png) ## Message Bus The Message Bus Task operates over the Message Bus communication layer, allowing you to publish messages, send messages with a request for a reply, and subscribe to specific subjects. To configure a Message Bus Task, provide a name and, optionally, a description. You can also customize its behavior by adjusting the following settings: * **Auto Refresh** - When enabled, the page will automatically update its data at defined intervals. You can set the specific interval according to your needs. The default setting is `false`. * **Retrieve Data on Start** - When enabled, the system will fetch and display relevant data as soon as the page loads. The default setting is `true`. * **Subject** - Define the subject to subscribe to or publish messages. ![Message Bus Task](images/uipage_transaction_message_bus.png) ## Service Call The Service Call Task can be used to execute a Service Call, providing input and gathering the output. To configure this task, you need to provide a name and, optionally, a description. Additionally, you can customize its behavior by adjusting the following settings: * **Auto Refresh** - When enabled, the page will automatically update its data at defined intervals. You can set the specific interval according to your needs. The default setting is `false`. * **Retrieve Data on Start** - When enabled, the system will fetch and display relevant data as soon as the page loads. The default setting is `true`. * **Retrieve Data on Changes** - When enabled, the system will update the data displayed whenever there are changes. The default setting is `true`. * **Show Feedback Messages** - Provides user feedback about the data retrieval process. The default setting is `false`. * **Show Error Feedback Messages** - Alerts users to errors encountered during data retrieval. The default setting is `false`. ![Service Call Task](images/uipage_transaction_service_call.png) The Service Call task includes a Setup tab, where you can select from existing services. Services are organized into categories, and within each category, you will find all related services. Each service has a Details page with general information, inputs it receives, and outputs it sends. ![Service Call Task 2](images/uipage_transaction_service_call_setup.png) ## Real Use Cases ### Execute Action on a UI Wizard This example demonstrates how to execute a custom DEE Action, using the Execute Action Task, from a UI Wizard. 1. Create a custom **DEE Action**, that will retrieve two input parameters - a string and an integer - from the UI, and return them as output values in a dictionary. Example DEE Action: ```csharp Input.TryGetValue("String", out object stringValue); Input.TryGetValue("Integer", out object integerValue); return new Dictionary { { "ValueChange", stringValue }, { "Value2Change", integerValue.ToString() } }; ``` 2. Create a **UI Page**. Choose a clear name and set the UI Type to `Wizard`. ![Create UI Page](images/create_ui_page.png) 3. Add a **Task** to the **UI Page**. Choose the **Settings** button on the top ribbon, navigate to the **Tasks** tab, select the :material-plus: icon to add a new **Task**, and provide the following details: * Name - `Transaction Service Call` * Type - `Execute Action` * DEE Action - `ExecuteActionExample` ![Configure UI Page Task](images/configure_ui_page_task.png) 4. Add a **Form** widget and, in the **Fields** tab, select the :material-plus: icon and define: * Name - `String` * Value Type - `String` ![Configure Form Fields](images/configure_form_fields_1.png) 5. In the same **Form** widget, add another field: * Name - `Integer` * Value Type - `Integer` ![Configure Form Fields](images/configure_form_fields_2.png) 6. Connect the **Form** and the **Task** by dragging the **Form** widget and the **Transaction Service Call** to the **Links** diagram. ![Connect the Form and the Task](images/links_diagram.png) 7. Configure the **Task** **Inputs** by going to the **Settings** of the **Transaction Service Call**, and in the **Inputs** tab, select the :material-plus: icon, and define: * Name - `Integer` * Type - `Integer` ![Configure Task Inputs](images/configure_task_input.png) 8. Then, navigate to the **Links** tab, select the :material-plus: dropdown, choose **Link**, and define: * Source - `Form` * Output - `String Change` * Target - `Transaction Service Call` * Input - `Input` ![Create the First Link](images/configure_links_1.png) 9. In the link you just configured, add a new **Converter** by selecting :material-plus: dropdown, choose **Converter**, and define: * Converter - `Set Value in Map` * Key (Static) - `String` ![Configure the Converter for Link 1](images/configure_converter_1.png) 10. Add another link, with the following parameters: * Source - `Form` * Output - `Integer Change` * Target - `Transaction Service Call` * Input - `Integer` ![Create Second Link](images/configure_links_2.png) 11. In the end, your **Links** diagram should resemble the image below. ![Final Result](images/links_diagram_final.png) 12. Finally, test the **UI Wizard**. Save the **UI Page** and open the browser **DevTools** network tab. * Enter a string in the first field (for example, `test`). * Enter a number in the second field (for example, `12`). * Select **Finish** to trigger the wizard action. You will see the ExecuteAction task in the network requests. Inspect the response payload to confirm the data was processed as expected. Watch the video below to see this use case in action. {% set video_id = '9dde18ea05b7105e0365ea4c1f578ea6' %} {% include-markdown 'includes/cloudflare_stream.md' %} !!! info "Download Example" You can download the complete UI Page of this example and import it directly into your environment [here](ui-pages-examples/execution_action_example_wizard.xml). For more information, see [[user-guide-uipages-import-export-uipage]]. ### Execute Action on a UI Page This example shows how to execute a System DEE Action (`CalculateMaterialQuantity`) in a standard UI Page. 1. Create a **UI Page**, choose a clear name, and set the UI Type to `Page`. ![Create UI Page](images/create_ui_page_example_2.png) 2. Add a **Task** to the **UI Page**. Choose the **Settings** button on the top ribbon, navigate to the **Tasks** tab, select the :material-plus: icon to add a new **Task**, and provide the following details: * Name - `Execute Action` * Type - `Execute Action` * DEE Action - `CalculateMaterialQuantity` (System DEE Action) ![Add a Task to the UI Page](images/configure_ui_page_task_example_2.png) 3. Add a **Form** widget and, in the **General** tab, add a descriptive Name (for example, `Material Selection`). ![Configure Form General tab](images/configure_form_general_material.png) 4. Next, navigate to the **Field** tab, select the :material-plus: icon, and define: * Name - `Material Selection` * Value Type - `ReferenceType` * Value Reference Type - `Entity Type` * Value Reference Type Name - `Material` ![Configure Form Fields tab](images/configure_form_fields_material.png) 5. Then, navigate to the **Links** tab, select the :material-plus: dropdown, choose **Link**, and provide: * Source - `Material Selection` * Output - `Material Change` * Target - `Execute Action` * Input - `Material` ![Configure Form Links tab](images/configure_form_links_material.png) 6. In the link you just configured, add a new **Converter** by selecting :material-plus: dropdown, choose **Converter**, and set it to `Load Entity`. ![Configure Converter](images/configure_form_converter_material.png) 7. Add another **Form** widget and, in the **General** tab, add a descriptive Name (for example, `Material Quantity`). ![Configure Form General tab](images/configure_form_general_result.png) 8. Next, navigate to the **Field** tab, select the :material-plus: icon, and define: * Name - `Material Selection` * Value Type - `ReferenceType` * Value Reference Type - `Entity Type` * Value Reference Type Name - `Material` ![Configure Form Field tab](images/configure_form_fields_result.png) 9. Then, navigate to the **Links** tab, select the :material-plus: dropdown, choose **Link**, and provide: * Source - `Material Selection` * Output - `Material Change` * Target - `Execute Action` * Input - `Material` ![Configure Form Links tab](images/configure_form_links_result.png) 10. In the end, your **Links** diagram should resemble the image below. ![Final Result Diagram](images/links_diagram_final_example_2.png) 11. And your **UI Page** should look like this: ![Final Result UI Page](images/ui_page_final_example_2.png) 12. Finally, test the **UI Wizard**. Save the **UI Page** and open the browser **DevTools** network tab. * Enter a material in the first field (for example, `Cookie01`) * The material quantity will be displayed automatically in the result field (in this example, `20`). At the same time, you will see the ExecuteAction task in the network requests. Open the response to verify the payload. Watch the video below to see this use case in action. {% set video_id = 'f3bf97c40bc32e717a3fb0c509eef17d' %} {% include-markdown 'includes/cloudflare_stream.md' %} !!! info "Download Example" You can download the complete UI Page of this example and import it directly into your environment [here](ui-pages-examples/execution_action_example_page.xml). For more information, see [[user-guide-uipages-import-export-uipage]].