-
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
Effective Salesforce Lead Management Tips And Best Practices
Companies that use Salesforce to boost their sales funnel and close more deals soon discover that they need to do more than just track sales…
Benefits of Hiring a Salesforce Managed Services Provider
Salesforce is among one of the most powerful and versatile business tools currently available. It can help businesses of all sizes streamline their processes and…
Strategies to Boost Nonprofit's Efficiency with Tableau CRM | Salesforce
With the Salesforce technology, known as Tableau CRM users can make data-driven decisions while saving a ton of time and money thanks to AI features…
Popular Salesforce Videos
Getting started with Salesforce integration patterns using MuleSoft
Learn how to develop different integration patterns between Salesforce and external systems. You can read the full tutorial, and download the project jar file by…
Salesforce Careers - Why Consider A Career In Salesforce
This Salesforce Training Video will help you understand about Salesforce, Salesforce market situation, Salesforce job trends, Salesforce career options and how Salesforce is a safe…
Salesforce Checkout: Manage Your Subscription & Buy Licenses
Watch this video to understand how to manage your Salesforce subscription and buy licenses on your own. This makes an easy process even easier, this…
Popular Salesforce Infographics
How to Create a Community of Trust and Gratitude with Salesforce
The businesses that will be remembered positively after COVID-19 are extending empathy and grace to their employees, customers, and communities. We’ve seen so many communities…
Choosing the Right Salesforce Partner - Guide
Tips To Hire The Right Salesforce Partner for Growth & Success Salesforce is compact with some of the most exemplary features like no other CRM…
Salesforce: A Powering Business Of All Sizes
Salesforce is a cloud-based software that helps businesses track and manage their interactions with customers and potential customers. More than 150,000 companies worldwide use Salesforce.…