Add value to an object
Function: Add value to an object
This action allows you to add a new piece of information (a 'value') to an existing collection of data (an 'object') or update an existing piece of information within it. You specify where to put this information using a unique label (a 'key'). Think of an object like a list of facts about something, where each fact has a name (the key) and a detail (the value).
Input,
- Object: The collection of data you want to modify. This is where you'll add or update information.
- Key: The unique label or name for the piece of information you're adding or updating. This tells the system exactly where to place the new value within the object.
- Value: The actual data or information you want to store under the specified Key. This can be text, a number, a date, or any other type of data.
Output,
This action does not produce a separate output. Instead, it directly modifies the Object you provided as an input, adding the new key-value pair or updating an existing one.
Execution Flow,
Real-Life Examples,
Here are some examples of how you might use the "Add value to an object" action in your application:
-
Adding a new contact detail to a customer profile:
- Inputs:
- Object:
Customer Profile(e.g., a record containing customer's name, address, email) - Key:
"Phone Number" - Value:
"555-123-4567"
- Object:
- Result: The
Customer Profileobject now includes a new entry for "Phone Number" with the value "555-123-4567".
- Inputs:
-
Updating the stock quantity for a product:
- Inputs:
- Object:
Product Details(e.g., a record containing product name, price, description) - Key:
"Stock Quantity" - Value:
50(a number)
- Object:
- Result: The
Product Detailsobject now shows "Stock Quantity" as 50. If "Stock Quantity" already existed, its value is updated; otherwise, it's added.
- Inputs:
-
Setting a user preference in their settings:
- Inputs:
- Object:
User Settings(e.g., a record containing user's language, notification preferences) - Key:
"Preferred Theme" - Value:
"Dark Mode"
- Object:
- Result: The
User Settingsobject now includes "Preferred Theme" set to "Dark Mode".
- Inputs: