Ask AI
Skip to main content

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 like FirstName, LastName, EmailAddress).
    • Mapping body:
      \{
      "FirstName": "firstNameField",
      "LastName": "lastNameField",
      "EmailAddress": "emailField"
      \}
      (Here, "firstNameField", "lastNameField", and "emailField" are the names of the input fields on your form.)
  • Result: A new Contact record is created with the first name, last name, and email from the form, stored in a variable named CREATED_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 like ProductName, DesiredQuantity, CustomerNotes).
    • Mapping body:
      \{
      "ProductName": "productNameInput",
      "DesiredQuantity": "quantityInput",
      "CustomerNotes": "notesTextArea"
      \}
  • Result: An ProductInquiry object is generated, containing the product name, quantity, and notes provided by the customer, accessible via the CREATED_DATA variable.

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 like FullName, DateOfBirth, ContactEmail, ContactPhone).
    • Mapping body:
      \{
      "FullName": "userFullName",
      "DateOfBirth": "userBirthDate",
      "ContactEmail": "contactInfoGroup.emailAddress",
      "ContactPhone": "contactInfoGroup.phoneNumber"
      \}
      (Here, contactInfoGroup is the name of the group of fields on your form, and emailAddress and phoneNumber are fields within that group.)
  • Result: An updated UserProfile object is created, with the user's full name, birth date, and the extracted email and phone number from the contact information group, stored in the CREATED_DATA variable.