Update an object
Function: Update an object
This action allows you to modify an existing "object" by adding new information or changing current values. An object is a collection of key-value pairs, like a record in a database or a set of details about something (e.g., a customer, a product, or an order). This updated object can then be used in other parts of your no-code logic, such as storing it in your database, sending it in an API call, or displaying it in your application.
Input
- Existing object (OBJECT): This is the original object that you want to modify. You can select it from your available data or variables within your workflow.
- Overwriting values (OBJECT): This is a collection of new fields and their values, or updated values for existing fields, that you want to apply to your "Existing object." This input is required.
Output
The Existing object you provided as input is directly updated with the new or modified values. This action does not create a new object or return a separate output; it changes the original object in place.
Execution Flow
Real-Life Examples
Here are some examples of how you can use the "Update an object" action in your no-code application:
Example 1: Updating a Customer's Contact Information
Imagine you have a customer object and need to update their email address and phone number.
- Inputs:
- Existing object:
\{
"id": "CUST001",
"name": "Alice Smith",
"email": "[email protected]",
"phone": "123-456-7890",
"address": "123 Main St"
\} - Overwriting values:
\{
"email": "[email protected]",
"phone": "987-654-3210"
\}
- Existing object:
- Result: The original customer object is updated.
\{
"id": "CUST001",
"name": "Alice Smith",
"email": "[email protected]",
"phone": "987-654-3210",
"address": "123 Main St"
\}
Example 2: Adding a New Field to a Product Record
You want to add a "last_updated_date" field to your product objects to track when they were last modified.
- Inputs:
- Existing object:
\{
"product_id": "PROD005",
"name": "Wireless Headphones",
"price": 99.99,
"in_stock": true
\} - Overwriting values:
\{
"last_updated_date": "2023-10-27"
\}
- Existing object:
- Result: The product object now includes the new field.
\{
"product_id": "PROD005",
"name": "Wireless Headphones",
"price": 99.99,
"in_stock": true,
"last_updated_date": "2023-10-27"
\}
Example 3: Updating Multiple Details for an Order
An order's status needs to change, and a new shipping address needs to be added.
- Inputs:
- Existing object:
\{
"order_id": "ORD789",
"customer_id": "CUST002",
"status": "Pending",
"total_amount": 150.00
\} - Overwriting values:
\{
"status": "Shipped",
"shipping_address": "456 Oak Ave, Anytown, USA"
\}
- Existing object:
- Result: The order object is updated with the new status and shipping address.
\{
"order_id": "ORD789",
"customer_id": "CUST002",
"status": "Shipped",
"total_amount": 150.00,
"shipping_address": "456 Oak Ave, Anytown, USA"
\}