+ Start a Discussion
domdickdomdick 

web-to-form does't work?

Hello,

 

I have an issue with Web-to-lead form. It doesn't seem to work for me using salesforce (sandbox) default generated code.

here is a code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<title>SFDC Form Test</title>
<head>
<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8">
</head>
<body>
<div>
<form action="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST">

<input type=hidden name="oid" value="MY VALUE">
<input type=hidden name="retURL" value="MY VALUE">

<label for="email">Email</label><input  id="email" maxlength="80" name="email" size="20" type="text" /><br>

<label for="first_name">First Name</label><input  id="first_name" maxlength="40" name="first_name" size="20" type="text" /><br>

<label for="last_name">Last Name</label><input  id="last_name" maxlength="80" name="last_name" size="20" type="text" /><br>

<input type="submit" name="submit">
</form>
</div>
</body>
</html>

 

Now runnig above code, It does returing a retURL. But when i search the record; it's pop up with there are no matching found message. Can someone post positive reply for my error?

 

Thanks

Best Answer chosen by Admin (Salesforce Developers) 
DeptonDepton

change 

 

https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8

 

for 

 

https://cs7.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8

 

AND

 

"MY VALUE", is your Sandbox org ID, be sure that you have the right one. Each time you refresh your sandbox the Org ID changes.

 

Go to Setup - Administration Setup - Company Information, and copy the Org ID from there.

Without it it won´t work.

 

It should work after this.

All Answers

DeptonDepton

 

Seems that this code has been generated in producion.

 

 

When you generate Web-to-Case/Lead html in Sandbox, the URL provided in the code should be  test.salesforce.com or as far as I can remember cs1.salesforce.com or cs2.salesforce.com,cs3,etc. so, the number related to your salesforce server.

 

Take a look at  your Sandbox home page URL, and change your form URL.

 

 

domdickdomdick

Thanks for the reply.

 

In sandbox, web-to-lead form generate the form URL like <form action="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST">.

 

Even, I have tried placing different URL test.salesforce.com or cs7.salesforce.com but unable to locate the record in salesforce.

 

i normally use test.salesforce.com for login and it will redirect to cs7.salesforce.com

 

-------------------

 

I did uncomment the hidden field to check debug <input type="hidden" name="debug" value=1>

after submission, I have got following message...

 

Your request has been queued.

Record Information:

oid: MY VALUE
retURL: MY VALUE
debug: 1
email: t2@test.com
first_name: Test
last_name: TEst
submit: Submit Query

 

But unable to find the record "t2@test.com" under "Lead" section.

DeptonDepton

change 

 

https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8

 

for 

 

https://cs7.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8

 

AND

 

"MY VALUE", is your Sandbox org ID, be sure that you have the right one. Each time you refresh your sandbox the Org ID changes.

 

Go to Setup - Administration Setup - Company Information, and copy the Org ID from there.

Without it it won´t work.

 

It should work after this.

This was selected as the best answer
DeptonDepton

Did it work?

domdickdomdick

Sorry for the late reply,

Yes, works good to me!

Thanks again!

DeptonDepton

Great!

Happy that it worked

 

Please change description including Sandbox, and mark it as solved so other people can use it in the future!!

 

:)