-
How to resolve the error in If-Else in Salesforce Marketing Cloud AMPscript?
I am trying the If-Else condition in the code but getting the error "Internal server error". Could you please help me out on the code given below:
%%[
IF RequestParameter("submitted")==true THEN
Var @insertSET @firstname = RequestParameter("First Name")
SET @lastname = RequestParameter("Last Name")
SET @phone = RequestParameter("Phone")
SET @email = RequestParameter("Email")
SET @rating = RequestParameter("Rating")
SET @description = RequestParameter("Description")
SET @status = RequestParameter("Status")%%[IF Rating>=0 AND Rating<=5 THEN]
SET @insert = InsertData("UC_Target_DE",
"First Name",@firstname,
"Last Name",@lastname,
"Phone",@phone,
"Email", @email,
"Rating",@rating,
"Description",@description,
"Status",@status)%%[ELSEIF Rating>5 AND Rating<=10 THEN}%%
SET @insert = InsertData("MT_Target_DE",
"First Name",@firstname,
"Last Name",@lastname,
"Phone",@phone,
"Email", @email,
"Rating",@rating,
"Description",@description,
"Status",@status)%%[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">
<label>Last Name: </label><input type="text" name="lastname" required="false">
<label>Email: </label><input type="email" name="email" required="true">
<label>Phone: </label><input type="phone" name="phone" required="false">
<label>Description: </label><input type="text" name="description" required="false">
<label>Status: </label><input type="text" name="status" required="false">
<label>Rating: </label><input type="number" name="rating" required="false">
<input name="submitted" type="hidden" value="true">
<input type="submit" value="Submit">
</form>
</td></tr></table>
Data saved = %%=v(@insert)=%%
%%[ ENDIF ]%%
Log In to reply.
Popular Salesforce Blogs
How Businesses Achieve Efficiency with the Right Salesforce Approach
Efficiency is key to business success in today's highly competitive world. The companies that are able to manage customer relationships efficiently, streamline processes and use…
What Are the Key Qualities to Look for When Hiring Salesforce Consultants in India?
In the dynamic landscape of business, Salesforce has emerged as a pivotal platform for companies seeking to streamline their operations, enhance customer relationships, and drive…
All About Record-Triggered Flows in Salesforce | The Salesforce Trailhead Guide
In this blog, we will discuss the topic of Triggered flows. There are three general types of flows: Screen Flow Auto launched Flow Triggered Flow …
Popular Salesforce Videos
The Only Salesforce Developer Video Tutorial Course You Will Ever Need!
A Salesforce developer is a programmer who builds Salesforce applications across various PaaS (Platform as a Service) platforms. A Salesforce developer has an understanding of…
Creating a Salesforce Lightning App in 12 Minutes
Salesforce is the easiest and quickest way to make quality enterprise apps using clicks instead of code.This video attempts to demonstrate just how quick and…
MuleSoft Integration: Google Ads Lead Form to Salesforce - Learn Salesforce Series by Algoworks
MuleSoft integration: Google Ads lead form to Salesforce. In this video, learn how MuleSoft can be used to integrate Salesforce with Google Ads lead form.…
Popular Salesforce Infographics
How to Become a Salesforce Consultant?
Begin your Salesforce Consultant journey with Trailhead to learn about the modules offered by Salesforce to its users - admin, business users and developers to…
How Salesforce Outsourcing Can Help Your Business Grow
We all know how beneficial is Salesforce for any business but people still wonder if it is beneficial to go for Salesforce Outsourcing services. This…
Things you need to know about Salesforce Commerce Cloud
Salesforce Commerce Cloud a.k.a. Demandware is a highly customized, multi-tenant, and cloud-based Software as a Service (SaaS) eCommerce solution. It offers a wide range of…