Create an object
Function: Create an object
This function allows you to build a structured collection of information, like a record or a data entry, directly within your application's logic. You can define various fields and their corresponding values to create a custom 'object' that can then be used in subsequent steps of your workflow. It's like creating a custom data entry form on the fly, where you define what information goes into it.
Input
- Object (MAP): This is where you define the structure and content of your new object. You'll specify all the fields (like "name", "email", "price") and their corresponding values (like "John Doe", "[email protected]", 19.99) that you want to include in the object. This input is required.
Output
- Created Object (MAP): This action creates a new object based on the structure and values you provided. This object will be stored in a variable within your application's memory. You will specify the name for this variable (e.g.,
customerData,productDetails). If you don't provide a name, it will default toNEW_OBJECT.
Execution Flow
Real-Life Examples
Here are some examples of how you can use the "Create an object" function in your applications:
Example 1: Creating a Customer Record
Imagine you're building a form to collect new customer information. After the user submits the form, you want to consolidate their details into a single, structured record.
- Inputs:
- Object:
\{
"firstName": "Alice",
"lastName": "Smith",
"email": "[email protected]",
"isActive": true,
"registrationDate": "2023-10-26"
\} - Object variable name:
newCustomer
- Object:
- Result: A new object containing Alice Smith's details is created and stored in a variable named
newCustomer. ThisnewCustomervariable can then be used in subsequent steps, for example, to display on a confirmation page, send a welcome email, or save to a customer database.
Example 2: Defining Product Specifications
You might need to dynamically create product details for an e-commerce application, perhaps based on user selections or data fetched from another system.
- Inputs:
- Object:
\{
"productName": "Wireless Headphones",
"modelNumber": "WH-1000XM5",
"price": 349.99,
"colorOptions": ["Black", "Silver", "Blue"],
"inStock": true,
"warrantyMonths": 24
\} - Object variable name:
productDetails
- Object:
- Result: An object holding the specifications for "Wireless Headphones" is created and saved as
productDetails. This variable can be used to populate a product catalog, generate an invoice, or update inventory records.
Example 3: Setting Up a Task Assignment
In a project management workflow, you could create a task object to assign work to team members.
- Inputs:
- Object:
\{
"taskName": "Review Marketing Campaign",
"assignedTo": "John Doe",
"dueDate": "2023-12-31",
"priority": "High",
"status": "Pending"
\} - Object variable name:
currentTask
- Object:
- Result: A task object with details like name, assignee, due date, priority, and status is created and stored in the
currentTaskvariable. This object can then be passed to another action to assign the task, send a notification to John Doe, or update a project dashboard.