-
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
Top 5 Reasons To Hire a Salesforce Consultant Over an Internal Admin
Adopting Salesforce can be quite a challenging decision if marketers fail to understand the Salesforce platform and its capabilities. Many organizations want to get the…
Drive Financial Growth with Sage Intacct Consulting benefits
Businesses that use the right solutions will stay ahead of the curve in a constantly shifting commercial environment. This is where Sage Intacct, a financial…
Salesforce Partner Levels and Tiers: A Complete Guide for Businesses
Selecting the right Salesforce partner is one of the most important decisions for a successful CRM implementation. While Salesforce provides a powerful platform, achieving the…
Popular Salesforce Videos
How to Create a Jira Ticket from Salesforce?
Learn how to create a Jira ticket in Salesforce using two different methods and how to choose a Jira project. Know more at https://www.sinergify.com/
Login Flow In Salesforce
You can use a login flow to customize the login experience and integrate business processes with Salesforce authentication. Common use cases include collecting and updating…
Introduction to Salesforce OmniStudio | Salesforce Industries
Introduction to Salesforce OmniStudio: The Salesforce OmniStudio digital engagement suite makes it easy to click-configure rich, consumer-grade user experiences based on objects, APEX classes, REST…
Popular Salesforce Infographics
Amplify Your Support Operations with Email to Case Advance | Salesforce
Managing cases efficiently in Salesforce is pretty easy. And given the rising expectations of customers, being fast to answer their queries via Salesforce-powered communities is…
Quick Comparison Guide to CRM Systems: Acumatica VS Salesforce Sales Cloud
When you are about to choose, the best and the most appropriate CRM solution for your business, always consider these 3 given points: customization, integration,…
Selecting the Ideal Salesforce Managed Service Provider
Explore our engaging infographic, offering guidance on choosing the perfect Salesforce Managed Service Provider to maximize your Salesforce investment. Explore key factors to consider when…