Ask AI
Skip to main content

Update a data record

Function: Update a data record

Write an updated data record to the built-in database. This action is used when you have an existing record and you want to change one or more of its fields. It's important to note that this action is for updating existing records, not creating new ones. If you need to create a new record, you should use the "Create data record" action instead.

Input

  • Data (DATA)
    • Description: The specific data record you wish to modify. This must be an existing record from your application's database.
    • Type: DATA (A record from your database)
    • Required: Yes
  • Async (IS_ASYNC)
    • Description: Determines whether the update operation should happen immediately (synchronously) or in the background (asynchronously).
    • Type: BOOLEAN (True/False)
    • Default Value: False (The update will happen immediately by default)

Output

This function does not produce a direct output variable. Its primary outcome is the modification of the specified data record in your database. If the update is successful, the record will reflect the new values. If an error occurs (e.g., the record doesn't exist, or there's an issue with the data provided), an error message will be generated.

Execution Flow

Real-Life Examples

Example 1: Update a Customer's Phone Number

Imagine you have a list of customers, and one customer's phone number has changed. You want to update their record in the database.

  • Inputs:
    • Data: A Customer record with ID: 101 and Phone Number: "555-123-4567"
    • Async: False
  • Result: The customer record with ID 101 in your database will immediately have its "Phone Number" field updated to "555-123-4567".

Example 2: Mark a Task as Completed (Asynchronously)

You have a project management application, and when a user clicks a "Complete Task" button, you want to update the task's status without making the user wait.

  • Inputs:
    • Data: A Task record with ID: 205 and Status: "Completed"
    • Async: True
  • Result: The system will schedule the update of Task 205's status to "Completed" to happen in the background. Your application can immediately proceed to the next step without waiting for the database update to finish.

Example 3: Adjust Product Price and Availability

A product's price has changed, and its availability status needs to be updated simultaneously.

  • Inputs:
    • Data: A Product record with ID: 310, Price: 49.99, and Available: True
    • Async: False
  • Result: The product record with ID 310 in your database will immediately have its "Price" field updated to 49.99 and its "Available" field set to True.