anusha(salesforce developer)

Monday 22 August 2016

Setting Record Type in Web-to-Lead in salesforce

Web-to-Lead is a simple and good feature in Salesforce out-of-the box. It will create HTML code and you just need to put it into your website and lead will be create in your Salesforce. It is simple enough without need to hire a developer to build code, but if your business requirements are much more complex, such as: integration with other system, build a custom code using API web service is the option.

This blog is not telling about how to set up Web-to-Lead, you can find the information here.

OK, so now you have web-to-lead form and you want it be assigned to a specific lead record type based on criteria.

Use hidden fields
You can add following input into HTML script generated by Salesforce
<input type=hidden name="fieldname" id="fieldid" value="value">
example:
<input type=hidden name="lead_source" id="lead_source" value="Email">
<input type=hidden name="recordType" id="recordType" value="01250000000HkoV">











If you set record type in Lead, you need to set in record type setting to "Keep the existing record type".
In Setup - Customize - Leads - Settings change the record type settings to "Keep the Existing Record Type".  The other option is "Override the existing record type with the assignee's default record type" which as stated means it will constantly be overridden by the record type of whoever you assign the lead to.


You can get the RecordType Id by going to Setup - Customize - Lead - Record Types.

Make sure that the profile assigned to the owner of the leads has the particular record type you're trying to assign visible to that profile. You can check from: Setup - Manage Users - Profiles - Edit. Find record type settings click "Edit" next to leads and add / remove record types to that profile.

Use workflow with field update
You also can use workflow to update Field Update field based on some criteria you can set in workflow, this option will work when you want to set different record type based on some criteria.

No comments:

Post a Comment