-
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 Future of Salesforce Marketing Cloud and Emerging Trends
Salesforce Marketing Cloud is a leading marketing automation platform that has transformed the way organizations engage with their customers. With its powerful features and functionalities,…
Master-Detail Relationship in Salesforce
Master-Detail relationship in Salesforce means a parent-child relationship between any two objects in which the parent object controls some certain behaviour of detail object i.e.…
Popular Salesforce Videos
How to Become a Certified Salesforce Admin
It is predicted there will be 1.9m new Salesforce job openings by 2020. Consultants thinking of a career in IT should consider training in cloud…
What is the Future of Salesforce Developer?
Salesforce Developer jobs are on the rise. A lot of MNC companies like TCS, Infosys, Cognizant, etc are hiring Salesforce developers. In this video, Musings…
How to Create a Landing Page in Salesforce Account Engagement (Pardot)?
A landing page acts as a customized doorstep for potential clients. It's crucial because it guides their focus toward a particular action, such as signing…
Popular Salesforce Infographics
Which Salesforce Certification is Right for You?
This informative infographic will help readers to decide which Salesforce certification is right choice for their Salesforce career.
The Salesforce Lightning Platform for Employee Engagement: Key Findings
Salesforce provides a system of engagement across the entire employee lifecycle that enables organizations to connect multiple back-end systems of record with one system of…
Benefits of Salesforce Commerce Cloud
As the online marketplace is continuously growing in the global economy, it's important to have a feature-loaded and scalable e-commerce platform. Salesforce commerce cloud is…