Update an ext. database
Function: Update an external database
This action allows you to modify existing records within an external database that is connected to your application. You can specify which table to update, define filters to target specific records, and provide the new data to be applied.
Input,
- Database connection: The connection details for the external database you wish to update.
- Table: The name of the specific table within the database where you want to update records.
- Data format: The structure or schema that describes the data in the chosen table. This helps the platform understand the fields you are working with.
- Filters: (Optional) A set of conditions to identify which records in the table should be updated. You can add multiple filters, each consisting of:
- Attribute: The specific field in your data format to check.
- Operator: How the attribute should be compared (e.g., "Equal", "Greater than", "Contains").
- Value: The value to compare against the attribute.
- Data: The new information you want to apply to the selected records. This should be provided as a structured set of key-value pairs, where keys match the attributes in your data format.
Output,
No direct output is returned by this action. Its primary effect is the modification of data in the external database.
Execution Flow,
Real-Life Examples,
Here are some practical ways you can use the "Update an external database" action:
Example 1: Update a customer's email address
Imagine a customer updates their email address through a form in your application. You need to reflect this change in your external customer database.
- Inputs:
- Database connection:
My CRM Database - Table:
Customers - Data format:
Customer Profile(with fields likeCustomerID,Email,Name) - Filters:
- Attribute:
CustomerID - Operator:
Equal - Value:
12345(the ID of the customer who updated their email)
- Attribute:
- Data:
\{
"Email": "[email protected]"
\}
- Database connection:
- Result: The customer record with
CustomerID12345in theCustomerstable ofMy CRM Databasewill have itsEmailfield updated to[email protected].
Example 2: Mark all pending orders as 'processing' for a specific product
Suppose a new batch of a popular product has arrived, and you want to update all customer orders for that product from "Pending" to "Processing".
- Inputs:
- Database connection:
My E-commerce Database - Table:
Orders - Data format:
Order Details(with fields likeOrderID,ProductID,Status) - Filters:
- Filter 1:
- Attribute:
ProductID - Operator:
Equal - Value:
PROD-XYZ
- Attribute:
- Filter 2:
- Attribute:
Status - Operator:
Equal - Value:
Pending
- Attribute:
- Filter 1:
- Data:
\{
"Status": "Processing"
\}
- Database connection:
- Result: All records in the
Orderstable whereProductIDisPROD-XYZANDStatusisPendingwill have theirStatusfield updated toProcessing.
Example 3: Correct a typo in a product description
You discover a common typo in the description of a product across multiple entries in your product catalog.
- Inputs:
- Database connection:
Product Catalog DB - Table:
Products - Data format:
Product Information(with fields likeProductName,Description) - Filters:
- Attribute:
Description - Operator:
Contains - Value:
incorrectly spelled word
- Attribute:
- Data:
\{
"Description": "corrected spelling of the word"
\}
- Database connection:
- Result: Any product record in the
Productstable whoseDescriptionfield contains "incorrectly spelled word" will have that specific part of itsDescriptionupdated to "corrected spelling of the word". (Note: For complex text replacements, you might need to combine this with other actions or ensure your database supports partial updates based onContainsfor text fields).