Map form data
Function: Map form data
This function helps you organize and transform information collected from a form into a structured format, like a record in your database or a specific data object. It allows you to define exactly how each piece of information from your form should fit into the fields of your chosen data structure.
Input,
- Data-format
- Description: Choose the specific data structure (like a "Customer" record or an "Order Item" object) that you want your form data to be mapped into. This defines the blueprint for your output.
- Type: DATA_FORMAT
- Mapping body
- Description: Define the rules that tell the system how to match fields from your form to the fields in your chosen "Data-format." This is an object where each key is a field name from your "Data-format," and its value is the name of the corresponding field from your form.
- Type: OBJECT
Output,
- Result
- Description: The name of the variable where the newly mapped, structured data will be stored. By default, this variable is named "CREATED_DATA."
- Type: OBJECT
Execution Flow,
Real-Life Examples,
Here are some examples of how you can use the "Map form data" function:
Example 1: Mapping a Simple Contact Form to a Contact Record
Imagine you have a simple contact form where users enter their first name, last name, and email. You want to save this information into a "Contact" data record.
- Inputs:
- Data-format:
Contact(This data format has fields likeFirstName,LastName,EmailAddress). - Mapping body:
(Here, "firstNameField", "lastNameField", and "emailField" are the names of the input fields on your form.)
\{
"FirstName": "firstNameField",
"LastName": "lastNameField",
"EmailAddress": "emailField"
\}
- Data-format:
- Result: A new
Contactrecord is created with the first name, last name, and email from the form, stored in a variable namedCREATED_DATA.
Example 2: Transforming a Product Inquiry Form to an Inquiry Object
Suppose you have a form for product inquiries, asking for the product name, quantity desired, and customer notes. You want to map this into an "Inquiry" data object.
- Inputs:
- Data-format:
ProductInquiry(This data format has fields likeProductName,DesiredQuantity,CustomerNotes). - Mapping body:
\{
"ProductName": "productNameInput",
"DesiredQuantity": "quantityInput",
"CustomerNotes": "notesTextArea"
\}
- Data-format:
- Result: An
ProductInquiryobject is generated, containing the product name, quantity, and notes provided by the customer, accessible via theCREATED_DATAvariable.
Example 3: Structuring a User Profile Update Form with Nested Information
Consider a user profile update form that includes basic details and a section for contact information (email and phone) grouped together. You want to map this to a "UserProfile" data format that has separate fields for email and phone.
- Inputs:
- Data-format:
UserProfile(This data format has fields likeFullName,DateOfBirth,ContactEmail,ContactPhone). - Mapping body:
(Here,
\{
"FullName": "userFullName",
"DateOfBirth": "userBirthDate",
"ContactEmail": "contactInfoGroup.emailAddress",
"ContactPhone": "contactInfoGroup.phoneNumber"
\}contactInfoGroupis the name of the group of fields on your form, andemailAddressandphoneNumberare fields within that group.)
- Data-format:
- Result: An updated
UserProfileobject is created, with the user's full name, birth date, and the extracted email and phone number from the contact information group, stored in theCREATED_DATAvariable.