Update a data record
Function: Update a data record
This function allows you to modify an existing record within your application's built-in database. It's crucial to remember that this action is specifically designed for existing data. If you need to add a brand new record, you should use the "Create data record" function instead. This function will not work with new data records.
Input
- Data (DATA): This is the specific data record you want to change. You must provide an existing record from your database. The platform will use the unique identifier of this record to locate and update it. This input is required.
- Async (BOOLEAN, default:
false): This setting determines how the update operation is performed.- If set to
True, the update will happen in the background, allowing your application to continue with other tasks immediately. You won't wait for the update to complete. - If set to
False(the default), the application will wait for the update to finish before proceeding. This ensures the data is updated before any subsequent actions.
- If set to
Output
No direct output is returned by this function. Its primary purpose is to modify the specified data record in your database. If the update is successful, the record will be changed. If an error occurs, an error message will be displayed.
Execution Flow
Real-Life Examples
-
Updating a Customer's Email Address (Synchronous):
- Scenario: A customer updates their email address on their profile page. You want to ensure the database reflects this change immediately before sending a confirmation email.
- Inputs:
- Data: An existing
Customerrecord (e.g., Customer ID:CUST001) with itsEmailfield updated to "new.email@example.com". - Async:
False
- Data: An existing
- Result: The
Customerrecord with IDCUST001in the database is immediately updated with the new email address. The application then proceeds, knowing the update is complete.
-
Adjusting Product Stock Levels (Asynchronous):
- Scenario: An inventory system processes a large shipment, and you need to update the stock quantity for a
Productrecord. This is a background task that doesn't need to block the user interface. - Inputs:
- Data: An existing
Productrecord (e.g., Product ID:PROD123) with itsStock Quantityfield updated from50to150. - Async:
True
- Data: An existing
- Result: The
Productrecord's stock quantity is updated in the database. The application continues processing other tasks without waiting for this specific stock update to finalize, as it happens in the background.
- Scenario: An inventory system processes a large shipment, and you need to update the stock quantity for a
-
Correcting a Task Status (Synchronous, with potential error handling):
- Scenario: A project manager marks a
Taskas "Completed". However, they accidentally try to update a task that was already deleted. - Inputs:
- Data: An existing
Taskrecord (e.g., Task ID:TASK456) with itsStatusfield updated to "Completed". (In this example, let's assume Task IDTASK456does not exist in the database). - Async:
False
- Data: An existing
- Result: The system attempts to find and update Task ID
TASK456. Since the task does not exist, an error message is displayed to the user, indicating that the record could not be found and therefore not updated.
- Scenario: A project manager marks a