Map form to object
Function: Map form to object
This function helps you organize information collected from a form into a structured object. Imagine you have a form where users enter various details, and you want to gather all that information into a single, easy-to-use package. This action takes the individual answers from your form fields and combines them into a single "object" (like a record or a collection of related data) based on rules you define.
Input,
- Mapping body: This is where you define how the data from your form fields should be structured in the resulting object. You specify which form field corresponds to which property in your new object. This input is required.
Output,
- Result: The name of the variable where the newly created object, containing all the mapped form data, will be stored. By default, this will be stored in a variable named
CREATED_DATA.
Execution Flow,
Real-Life Examples,
Here are a few examples of how you can use the "Map form to object" function:
Example 1: Collecting Customer Contact Information
You have a form for new customer sign-ups with fields for "First Name", "Last Name", "Email Address", and "Phone Number".
- Inputs:
- Mapping body:
(Note: "First Name Field" refers to the unique identifier/code of your actual form field for first name, and so on for the others.)
\{
"firstName": "First Name Field",
"lastName": "Last Name Field",
"email": "Email Address Field",
"phone": "Phone Number Field"
\} - Result:
newCustomer
- Mapping body:
- Result: A new object named
newCustomeris created, containing properties likefirstName,lastName,email, andphone, populated with the data entered by the customer in the form.
Example 2: Processing an Order Request
A user fills out an order form including "Product Name", "Quantity", "Shipping Address", and "Payment Method".
- Inputs:
- Mapping body:
\{
"product": "Product Name Field",
"quantity": "Quantity Field",
"shippingAddress": "Shipping Address Field",
"paymentMethod": "Payment Method Field"
\} - Result:
orderRequest
- Mapping body:
- Result: An object named
orderRequestis generated, holding all the details of the customer's order, ready to be processed by another action.
Example 3: Consolidating Feedback Survey Responses
You've designed a survey with fields like "Overall Rating", "Comments", and "Would Recommend".
- Inputs:
- Mapping body:
\{
"rating": "Overall Rating Field",
"feedbackComments": "Comments Field",
"recommend": "Would Recommend Field"
\} - Result:
surveyResponse
- Mapping body:
- Result: A structured object called
surveyResponseis created, containing the user's rating, comments, and recommendation status, making it easy to analyze the survey results.