Web-to-Lead 的使用

Web-to-Lead 是 Salesforce 一个很重要的特型,但也很容易被人忽视。Web-to-Lead 提供了一个从外部网站很简单的创建一个 Lead 到 Salesforce 的方式。在 Salesforce 中利用 Web-to-Lead 功能可以生成一个简单的 Form 表单,之后可以把这个 Form 表单内嵌到我们的外部网页中。接下来我们看一下如何创建,发布和调试 Web-to-Lead。

创建 Web-to-Lead

Setup > Build > Customize > Leads > Web-to-Lead

Web-to-Lead Enabled checkbox – 当这个值为 True 的时候,才能使用 Web-to-Lead 功能。

Default Record Creator – 当 Lead 被创建的时候,这个值会作为 Lead 上的 "Created By" field。大部分情况下,这个值也被作为 Lead Record Owner, 但是如果你配置了 Lead Auto-Assignment rules 后,Owner 可能会被改变。

Default Response Template – 如果这个值不为空的话,哪么当一个 Lead 被提交后,将使用你填充的值给 Lead 的 Owner 发送邮件。如果你需要根据不同的条件(Form 表单上的某些值)发送不同的 Email Template 给 Lead 的 Owner,哪么,我们需要设置这个值为空并且到这里Setup > Build > Customize > Leads > Lead Auto-Response Rules 配置你所需要的 Lead Assignment Rules。

好了, 现在单击 Create your Web-to-Lead Form


Select the fields to include on your Web-to-lead form – 添加你所需要的字段到 Form 表单。另外如果你需要额外的信息来存储,可以创建对应的 Custom Fields 并且添加他们到表单中。

Return URL – 当表单提交后,页面会跳转到这个路径。

单击 Generate button。生成以下代码。

<!--  ----------------------------------------------------------------------  -->  
<!--  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://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST">  
<input type=hidden name="oid" value="00D90000000****">  
<input type=hidden name="retURL" value="http://www.baidu.com">  
<!--  ----------------------------------------------------------------------  -->  
<!--  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="samba.gao@hotmail.com">   -->  
<!--  ----------------------------------------------------------------------  -->  
<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>  
<label for="email">Email</label><input  id="email" maxlength="80" name="email" size="20" type="text" /><br>  
<label for="company">Company</label><input  id="company" maxlength="40" name="company" size="20" type="text" /><br>  
<label for="city">City</label><input  id="city" maxlength="40" name="city" size="20" type="text" /><br>  
<label for="state">State/Province</label><input  id="state" maxlength="20" name="state" size="20" type="text" /><br>  
<input type="submit" name="submit">  
</form>

发布 Web-to-Lead

把上面生成的代码保存到一个 html 文件中,之后用浏览器打开这个文件。

填充正确的信息后,单击 Submit button, 这些信息会保存到 Salesforce Lead 记录上并跳转到www.baidu.com

调试 Web-to-Lead

首先我们来分析下面这段代码。

<form action="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST">  
<input type=hidden name="oid" value="00D90000000****">  
<input type=hidden name="retURL" value="http://www.baidu.com">  

action - 这是一个很重要的 URL, 当表单提交后,会以 POST 的形式发送到 Salesforce。

oid - Salesforce 中的 Org ID, 你能找到它在 Setup > Administer > Company Profile > Company Information – 你将看到 Salesforce Org ID 的值。

retURL - 表单提交后跳转的 URL 路径。

接着继续分析下面的代码

<input type="hidden" name="debug" value=1>  
<input type="hidden" name="debugEmail" value="samba.gao@hotmail.com">  

上面的代码默认是注释的,为了方便调试,我们需要把注释去掉。如果 debug 的值是1的话,在表单提交后你会看到一些调试的信息。

结语

更多 Salesforce 学习资料将在后续推出,敬请关注。如果有什么问题可以发送到我的邮箱:samba.gao@meginfo.com。

Samba

Read more posts by this author.