function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
aiyaz_SFDCaiyaz_SFDC 

Web-To-Lead (using existing company form.. php) - not capturing leads

Hi,

 

I am having  problem with a web to lead form not capturing leads in the system.  If I just simply generate the code from the web-to-lead generator it works with no problem, however when using an existing form and addeing the input type="hidden" name="sfga" value="OID",  it goes not seem to work.  I got this straight from the help section (Setting Up Lead Tracking - https://na1.salesforce.com/help/doc/user_ed.jsp?section=help&target=adwords_lead_conversion_tracking.htm&loc=help&hash=TestSetup-title)

 

Any help will be great on this.  Thank you.

 

Below is a snippet of what has been added.

 

<form onSubmit="saveHarvestPoints();chkfrm(this);" name="frm" method="post" action="/common/php/autodemo.php"> <input type="hidden" name="sfga" value="00D30000000XXXXX (the actualy org ID)"/> <input type="hidden" name="postpage" value="cpm_autodemo_request">

 

werewolfwerewolf
Well are you ever actually posting it to the Web2Lead servlet?  Your post action looks a little funny there.
aiyaz_SFDCaiyaz_SFDC

Is this mandatory?  It does work when I use the generated code and post to the web-to-lead servlet below:

 

<form action="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST">

 

Thanks

werewolfwerewolf
Yes, it's mandatory.  If you never post the information to Salesforce.com then Salesforce.com will never register your lead.
aiyaz_SFDCaiyaz_SFDC

That makes complete sense to me, however I was wondering whether step 2 in the following URL  (Website setup instruction) was assuming the servlet was being posted to.

 

https://sfma.salesforce.com/lead_tracking_setup/printable_instructions

werewolfwerewolf
It does, and you'll see in step 1 they're posting to that servlet.
Lawrence-CECLawrence-CEC

Actually, step 1 is unclear about where the form is being submitted to... In the 'existing lead capture forms' section at the bottom of step 1 it says:

 

place an extra hidden "sfga" field into your form as shown here:

 

and shows:

 

<FORM action="http://www.mycompany.com/customform.php">
...

<!-- Add the following hidden field to your existing lead capture forms -->
<INPUT type="hidden" name="sfga" value="" />
...

 

Which looks to me like you don't need to change the action="" attribute to point to SalesForce.

 

(I'm new and haven't tried this, but I'm trying to figure out the easiest way to get the info we are already collecting from visitors to our site into SalesForce ... while still having the data go into the existing script.)

 

---Lawrence

aiyaz_SFDCaiyaz_SFDC

I think I may have found something that works with PHP.  I"ll update this thread once I get the chance.

 

Thanks

Lawrence-CECLawrence-CEC

Don't know if you have the API toolkit (like for PHP ... which is what our form processing scripts are written in).

 

Creating a lead from within an existing form processing script is really easy if you have the basic connection to SalesForce already working within your script. It's a simple matter of doing:

 

 $fields = array (
'FirstName' => 'John',
'LastName' => 'Smith', // Required for Leads
'Phone' => '510-555-5555',
'Company' => 'Example Corp.' // Required for Leads
);

$sObject = new SObject();
$sObject->fields = $fields;
$sObject->type = 'Lead';

$createResponse = $mySforceConnection->create(array($sObject));

 

Thank God I found that rather than trying to dig through the Web to Leads stuff! :)