-
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 Salesforce CPQ Software Eliminates Sales Hurdles?
In this era of an automated CRM solution like Salesforce CPQ, if your sales team is still struggling in generating quotes, writing proposals and closing…
Why Should you Hire a Salesforce Pardot Consultant: Key Reasons to Know
Are you finding Salesforce Pardot Implementation a daunting task? Don’t worry. We are here with our complete guide on Salesforce Pardot Consultants and why should you hire them. What…
Product Bundles in Salesforce CPQ in 2024
As a strategic sales tool, Salesforce CPQ has many attractive features that take the personalized sales process to the next level. Increasingly, the customer’s shopping…
Popular Salesforce Videos
Web to Case Functionality in Salesforce | All You Need to Know
This video discusses the functionality of Web to Case in Salesforce, which allows website users to submit inquiries or information that can be converted into…
Winter '21 Release | Salesforce Tutorial Video
The Sandbox Preview window for Winter '21 begun on September 11, 2020. You must have an active sandbox on a preview instance before then to…
Popular Salesforce Infographics
How to Select Best Salesforce Implementation Partner
Selecting a Salesforce Implementation Partner may be both challenging and straightforward at the same time, particularly if this is your first time searching for a…
Salesforce CRM Integration With External Systems
Salesforce integration is one of the most important aspects of Salesforce services. It allows businesses to keep their Salesforce environment up and running. Integration Features…
The Benefits Of PDO Partnerships & Its Strategic Advantages
Salesforce Product Development Outsourcers (PDOs) are specialized partners in the Salesforce ecosystem that help organizations develop, build, and bring their applications to the Salesforce AppExchange.…