How to generate leads in Salesforce CRM using Laravel?

In this article we will teach you how to generate leads in salesforce crm using laravel.

Sometimes we use the CRM(Customer Relationship Management) Softwares to manage our sales, products or services, customers or client tracking, data analysis, sales tracking, marketing or any other integrations like email, chatting, sms etc.

For an example we are using the Salesforce CRM and we have a website. Now we want to generate leads in CRM through website. So, to do this we need to use the web-to-lead feature which is available in Salesforce CRM. It allows us to save leads in Salesforce CRM.

Using Salesforce Web to Lead in Laravel, PHP or HTML

To integrate Salesforce web to lead in laravel. We can use the code given below.

<!--  ----------------------------------------------------------------------  -->
<!--  NOTE: Please add the following <META> element to your page <HEAD>.      -->
	<!--  If necessary, please modify the charset parameter to specify the        -->
	<!--  character set of your HTML page.                                        -->
	<!--  ----------------------------------------------------------------------  -->

	<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8">

	<!--  ----------------------------------------------------------------------  -->
	<!--  NOTE: Please add the following <FORM> element to your page.             -->
		<!--  ----------------------------------------------------------------------  -->

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

			<input type=hidden name="oid" value="06HSDF55RERWEKNRTRTRI">
			<input type=hidden name="retURL" value="http://example.com/salesforce_return_url">

			<!--  ----------------------------------------------------------------------  -->
			<!--  NOTE: These fields are optional debugging elements. Please uncomment    -->
			<!--  these lines if you wish to test in debug mode.                          -->
			<!--  <input type="hidden" name="debug" value=1>                              -->
			<!--  <input type="hidden" name="debugEmail" value="[email protected]">   -->
			<!--  ----------------------------------------------------------------------  -->

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

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

			<label for="phone">Phone</label><input  id="phone" maxlength="40" name="phone" size="20" type="text" /><br>

			<label for="description">Description</label><textarea name="description"></textarea><br>

			<label for="lead_source">Lead Source</label><select  id="lead_source" name="lead_source"><option value="">--None--</option><option value="Advertisement">Advertisement</option>
				<option value="Web">Web</option>
			</select><br>

			<input type="submit" name="submit">

		</form>

Code Explanation:

  • In the code above https://webto.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8 is the form action where our data will go.
  • oid is the owner id, retURL is your website URL where CRM will redirect after form submit and other form fields are just your CRM Fields name
  • All these you can get, just visit this https://ap16.lightning.force.com/lightning/setup/LeadWebtoleads/home, login to your CRM and click on Create Web to Lead Form Button.

That’s it Now you can generate leads in Salesforce CRM using Laravel.

You can also generate leads in Salesforce CRM using CURL in Php or Laravel.

If you want more tutorials and tricks about laravel then visit our Laravel Page.

Subscribe Your Email, Follow Us on FacebookTwitter, TumblrLinkedIn.

If you like this article then share this.