-
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
The Conflict of Cloud CRM System: Salesforce Vs Oracle
The growth in demand for cloud services technologies in recent years has been noticeable. As businesses increasingly invest in cloud computing technology, it has become…
Salesforce Mobile Application - All You Need to Know About
Salesforce Mobile App is the mobile app of Salesforce which is more like of a Salesforce on the Go! This app provides you with the…
The Salesforce Customization Dilemma: Get In or Stay Out?
You have your Salesforce solution set up and running and it seems all you’ve got to do right now is relax and enjoy the moment.…
Popular Salesforce Videos
How Admins Can Improve Salesforce Data Quality
Learn how to diagnose the accuracy of your data and build a plan to maintain and enhance its’ quality using Salesforce tools. Follow along to…
Top 3 Things to See at Dreamforce 2021 | Salesforce
Three things you definitely don't want to miss at Dreamforce this year? 👆 #DF21 is packed with tons of educational content about your fave Salesforce…
Popular Salesforce Infographics
Welcome to the Internet of Customers | Salesforce Infographic
You’ve heard this age-old adage a thousand times: “The customer is always right.” Today more than ever, the customer has countless technologies and practices in…
How Customer Experience Is Rewriting the Rules of Business Success
Your guide to customer experience - Customers expectations are changing. And as they change, businesses face sky high standards for delivering customer experience that's a…
In 2021, Keep An Eye On The Following Salesforce Trends
Salesforce is the most popular customer relationship management (CRM) software. Salesforce has solutions for your sales, marketing, IT, service, and commerce teams so you can…