Update a data-body
Function: Update a data-body
This action allows you to modify the content (or "body") of an existing piece of data within your current workflow. Think of it as preparing or adjusting information before it's permanently saved or used in another step.
Important: This action does not save the changes to your database. It only updates the data object in your application's memory. To save the updated data, you would typically follow this action with a "Save Data" or "Update Data" action.
Input
- Existing data: This is the specific record or item you want to modify. It must be a piece of data that is already available in your current workflow, perhaps from a previous step like "Get Data" or a form submission.
- Body: This is the new information you want to put into your "Existing data." You can either type in the new fields and their values directly, or you can select an "object" from your workflow that contains the new information. This new "Body" will completely replace the existing content of your data.
Output
This action does not create a new output variable. Instead, it modifies the "Existing data" input variable directly. After this action runs, your "Existing data" variable will contain the updated "Body" information, ready for subsequent actions in your workflow.
Execution Flow
Real-Life Examples
Example 1: Preparing a Customer Record for Update
Imagine you have a customer form where users can update their details. You first retrieve the existing customer record, then allow the user to make changes. Before saving, you might use this action to consolidate the changes.
- Inputs:
- Existing data: A customer record retrieved from your database (e.g.,
Customer_Record_from_DB). - Body: An object containing the new details entered by the user in a form (e.g.,
Form_Input_Customer_Detailswhich might have\{"address": "123 Main St", "city": "Anytown"\}).
- Existing data: A customer record retrieved from your database (e.g.,
- Result: The
Customer_Record_from_DBvariable now contains the updated address and city. You can then use a "Save Data" action to persist these changes to your database.
Example 2: Adjusting an Order Item in a Shopping Cart
A user is reviewing their shopping cart and decides to change the quantity of an item or add a special note.
- Inputs:
- Existing data: A specific item from the shopping cart (e.g.,
Cart_Item_Product_A). - Body: An object with the updated quantity and a new note (e.g.,
\{"quantity": 3, "notes": "Gift wrap requested"\}).
- Existing data: A specific item from the shopping cart (e.g.,
- Result: The
Cart_Item_Product_Avariable now reflects the new quantity and includes the gift wrap note. This updated item can then be used in a "Calculate Cart Total" action.
Example 3: Configuring a Dynamic Report Request
You are building a feature where users can generate custom reports by selecting various filters and date ranges. You need to assemble these selections into a single configuration object before sending it to a report generation service.
- Inputs:
- Existing data: An empty or default report configuration object (e.g.,
Report_Config_Object). - Body: An object containing the user's selected filters and date range (e.g.,
\{"startDate": "2023-01-01", "endDate": "2023-12-31", "statusFilter": "Completed"\}).
- Existing data: An empty or default report configuration object (e.g.,
- Result: The
Report_Config_Objectvariable now holds all the user-defined parameters for the report. This configured object can then be passed to an action that triggers the report generation.