Toggle Side Panel
Forcetalks
  • Home
  • Articles
    • All Articles
    • Blogs
    • Videos
    • Infographics
  • Consultants
    • Salesforce Product Expertise
      • Top Salesforce ConsultantsTop Salesforce Consultants
    • Salesforce Industry Expertise
    • Salesforce Experts by Location
  • Webinars
  • Contact Us
More options
    Sign in Sign up
    • Home
    • Articles
      • All Articles
      • Blogs
      • Videos
      • Infographics
    • Consultants
      • Salesforce Product Expertise
        • Top Salesforce ConsultantsTop Salesforce Consultants
      • Salesforce Industry Expertise
      • Salesforce Experts by Location
    • Webinars
    • Contact Us
    Close search

    Landing Page Login Form And Save Data In Salesforce Data Extensions

    montyipecgmail-com
    Manish May 19, 2020
    Salesforce Data Extensions

    As all we know, Salesforce Marketing Cloud is a tool that provides digital marketing automation and services and analytics software. And Landing page is an important part of it. In Email Studio, Landing Pages provide an alternative interface to the microsites feature.

    Here I am sharing my knowledge with all, how to save data in Data extensions using the Login form created on the Landing page with the help of Ampscript.

    Starting this topic there is a basic knowledge of amp script, for that also I have written a blog for AmpScript. And for more information, visit on amp script guide Link.

    dont miss out iconDon’t forget to check out: Salesforce Marketing Cloud: AmpScript Basics

    Ampscript guide Link: https://ampscript.guide/introduction/

    So for creating a landing page we should follow steps: from the right top corner create a landing page.

    • Go to Web Studio and create a collection, next open the collection
    • Provide a Landing Page Name.
    • Select the layout you want to use.
    • And Paste the code mentioned below, and change the Data extension name in code by the name you created in your organization.

    Code:

    %%[
    IF RequestParameter("submitted")==true THEN
           Var @insert
           SET @firstname = RequestParameter("First Name")
           SET @lastname = RequestParameter("Last Name")
           SET @phone = RequestParameter("Phone")
           SET @email = RequestParameter("Email")
           SET @rating = RequestParameter("Rating")     
           SET @insert = InsertData("Data_Extn_Name",
           "First Name",@firstname,
           "Last Name",@lastname,
           "Phone",@phone,
           "Email", @email)       
    ]%%
    %%[ ELSE ]%%
    <table style="padding: 20px;"><tr><td>
         <h2>Please Fill the form:</h2>
          <form action="%%=RequestParameter('PAGEURL')=%%" method="post">   
           <label>First Name: </label><input type="text" name="firstname" required="false"><br>
             <label>Last Name: </label><input type="text" name="lastname" required="false"><br>
             <label>Email: </label><input type="email" name="email" required="true"><br>
             <label>Phone: </label><input type="phone" name="phone" required="false"><br
             <input name="submitted" type="hidden" value="true"><br>
             <input type="submit" value="Submit">
          </form>  
    </td></tr></table>
    %%=v(@insert)=%%
    %%[ ENDIF ]%%

    You can see how it looks like on the landing page: 

    fill form

    dont miss out iconCheck out this amazing video here: Salesforce Tutorial – Creating Custom Object

    Function – InsertData:-

    InsertData function inserts a row in a Data Extension with the specified column name and value pairs. It returns the number of rows inserted by the operation.

    Link for AmpScript Guide Documentation: https://ampscript.guide/insertdata/

    Now there is another scenario comes, how to save data in two different data extensions based on a particular field value, here I am taking rating field  from DE,

    I am going to show you how to save data in different Data extensions based on ratings.

    %%[
    IF RequestParameter("submitted")==true THEN
           Var @insert   
           SET @firstname = RequestParameter("First Name")
           SET @lastname = RequestParameter("Last Name")
           SET @phone = RequestParameter("Phone")
           SET @email = RequestParameter("Email")
           SET @rating = RequestParameter("Rating")     
    ]%% 
      %%[    [IF @rating >=0 AND @rating <= 5 THEN]       
       [SET @insert = InsertData("Data_Extn_Name1",
           "First Name",@firstname,
           "Last Name",@lastname,
           "Phone",@phone,
           "Email", @email,
           "Rating",@rating) ]      
           [ELSEIF @rating > 5 AND @rating <= 10 THEN]
           [SET @insert = InsertData("Data_Extn_Name2",
           "First Name",@firstname,
           "Last Name",@lastname,
           "Phone",@phone,
           "Email", @email,
           "Rating",@rating)    
           [ENDIF]
    ]%%
    %%[ ELSE ]%%
    <table style="padding: 20px;"><tr><td>
         <h2>Please Fill the form:</h2>
          <form action="%%=RequestParameter('PAGEURL')=%%" method="post">   
           <label>First Name: </label><input type="text" name="firstname" required="false"><br>
             <label>Last Name: </label><input type="text" name="lastname" required="false"><br>
             <label>Email: </label><input type="email" name="email" required="true"><br>
             <label>Phone: </label><input type="phone" name="phone" required="false"><br>
            <label>Rating: </label><input type="number" name="rating" required="false"><br>
             <input name="submitted" type="hidden" value="true"><br>
             <input type="submit" value="Submit">
          </form>  
    </td></tr></table>
     %%=v(@insert)=%%
    %%[ ENDIF ]%%
    Categories: Data, Salesforce, Salesforce Apex
    Tags: Data extensions, Email Studio, Landing Page, Landing Page Login Form, Marketing Automation, Salesforce Developer Guide, Salesforce Marketing Cloud, Web Studio

    Get listed your company

    Have an innovative Salesforce solution that delivers faster, smarter results?
    Join the Marketplace

    [adinserter block=”16″]

    best salesforce consultants
    best salesforce consultants
    best salesforce consultants
    salesforce consultants

    [adinserter block=”10″]

    salesforce consultants

    [adinserter block=”10″]

    salesforce consultants

    [adinserter block=”10″]

    salesforce consultants

    [adinserter block=”10″]

    salesforce consultants
    salesforce consultants

    [adinserter block=”10″]

    salesforce consultants
    Footer Forcetalks logo

    support@forcetalks.com

    • twitterx

    Quick Links

    Advertise with Us

    Salesforce® Articles

    Dreamforce 2023

    Top Salesforce® Bloggers 2023

    Top Salesforce Consultants

    Get Listed

    Company

    Contact Us

    About Us

    Privacy Policy

    Terms & Conditions

    InsightHub

    Salesforce Blogs

    Salesforce Videos

    Salesforce Groups

    Salesforce Jobs

    Forcetalks

    © 2026 - Forcetalks ● All Rights Reserved

    Salesforce® is a trademark of Salesforce® Inc. No claim is made to the exclusive right to use “Salesforce”. Any services offered within the Forcetalks website/app are not sponsored or endorsed by Salesforce®.