-
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
Improve Patient Experience with Salesforce Health Cloud
Patients are conserved and sensitive towards what kind of healthcare services they experience. When the systems of healthcare face issues like documentation, customized health plans,…
Dig Deeper into Salesforce Net Zero Cloud | The Ultimate Guide
In our last blog, we told you about one of the latest products from Salesforce called Net Zero Cloud designed to help businesses measure and…
Things To Consider When Choosing a CRM | Salesforce
Regardless of the size of the company or where it is in its lifecycle, selecting the right CRM is a crucial decision. Yet, far too…
Popular Salesforce Videos
Stay Focused with Salesforce Customer 360
It's never easy to stay focused when distractions are pouring in from work, home, and everywhere in between. That’s why Salesforce Customer 360 helps business…
Salesforce Professional Services Helps Customers Get Value From Salesforce, Faster
Our experts have helped thousands of customers transform their businesses, operating models, and cultures, all backed by the full power of Salesforce. Watch this video…
How to Crack Salesforce Platform Developer I Exam in 2021?
Salesforce Platform Developer I Certification Training ensures that you master the concepts and components of application development on the Salesforce platform. Watch this video and…
Popular Salesforce Infographics
Salesforce in the UK: Fun Facts & Figures
The UK and Salesforce: now, if that relationship wasn’t love at first sight, nothing is! As platinum partners of Salesforce and with an office in…
Dreamforce Facts & Numbers INFOGRAPHIC
We are now just a week away from the biggest Cloud carnival of the world ‘Dreamforce‘. Trailblazers from across the globe will be in San…
Salesforce Service Cloud for Better Customer Service
Service Cloud is classified as a customer support platform or customer relationship management (CRM) platform. It was designed to improve how businesses interact with their…