SF-Salesforce.WebToLead
0.0.5.7
dotnet add package SF-Salesforce.WebToLead --version 0.0.5.7
NuGet\Install-Package SF-Salesforce.WebToLead -Version 0.0.5.7
<PackageReference Include="SF-Salesforce.WebToLead" Version="0.0.5.7" />
<PackageVersion Include="SF-Salesforce.WebToLead" Version="0.0.5.7" />
<PackageReference Include="SF-Salesforce.WebToLead" />
paket add SF-Salesforce.WebToLead --version 0.0.5.7
#r "nuget: SF-Salesforce.WebToLead, 0.0.5.7"
#:package SF-Salesforce.WebToLead@0.0.5.7
#addin nuget:?package=SF-Salesforce.WebToLead&version=0.0.5.7
#tool nuget:?package=SF-Salesforce.WebToLead&version=0.0.5.7
Summary - Sitefinity → Salesforce Web-to-Lead Integration
Context / Problem
Platform: Sitefinity 14/15 (ASP.NET Framework)
Goal: Sync Sitefinity Forms → Salesforce Leads
Issue: Built-in Sitefinity Salesforce connector is deprecated (SOAP API v28, dead since Sept 2025).
Progress confirmed they will not update the connector.
Originally built to solve the gap on Sitefinity 14.4; the integration is also working and tested on Sitefinity 15.
Chosen Solution (Final Architecture)
Custom Sitefinity Forms event handler → Salesforce Web-to-Lead
Avoids deprecated connectors
No Salesforce API / OAuth / API versioning
Uses Salesforce's supported, long-term Web-to-Lead endpoint
No Sitefinity Service Hooks (because they POST JSON, Web-to-Lead requires form-url-encoded)
Data Flow
Sitefinity Form Submit -> IFormEntryCreatedEvent -> Custom async handler (FormUrlEncoded POST) -> Salesforce Web-to-Lead endpoint -> Lead created
Get Started
1. Install NuGet Package
Package ID: SF-Salesforce.WebToLead
To get started, install package into your Sitefinity project via Nuget. First, check that your Nuget.config is set up correctly:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="sitefinity" value="https://nuget.sitefinity.com/nuget" />
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
In your Sitefinity project, open Visual Studio Package Manager console and run:
Install-Package SF-Salesforce.WebToLead -Version "[latest version on Nuget]"
After install, check for reference in packages.config:
<packages>
...
<package id="SF-Salesforce.WebToLead" version="0.0.5.7" targetFramework="net48" />
</packages>
Also check .csproj file for Sitefinity. Should include a following similar reference:
<Reference Include="Sitefinity.Salesforce.WebToLead">
<HintPath>packages\SF-Salesforce.WebToLead.0.0.5.7\lib\net48\Sitefinity.Salesforce.WebToLead.dll</HintPath>
</Reference>
2. Add Configuration
All configuration lives in the Sitefinity web project's web.config, not the class library.
<appSettings>
<add key="Sitefinity-SfW2L:Enabled" value="true" />
<add key="Sitefinity-SfW2L:WebhookUrl" value="https://webto.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" />
<add key="Sitefinity-SfW2L:OrgId" value="00Dxxxxxxxxxxxx" />
<add key="Sitefinity-SfW2L:AllowedForms" value="contact-us, request-a-demo" />
<add key="Sitefinity-SfW2L:AllowedCompanies" value="Acme Inc, Example Corp" />
<add key="Sitefinity-SfW2L:AllowedLeadSources" value="Website - Contact, Website - Demo" />
<add key="Sitefinity-SfW2L:CustomFieldPrefix" value="sf_" />
<add key="Sitefinity-SfW2L:Debug" value="false" />
</appSettings>
Notes per key:
Sitefinity-SfW2L:Enabled- required; true/false toggle for the hook; empty throws exceptionSitefinity-SfW2L:WebhookUrl- required; absolute https URL; invalid values throw at startupSitefinity-SfW2L:OrgId- required; Salesforce Org ID; empty throws exceptionSitefinity-SfW2L:AllowedForms- required; comma-separated list of form slugs, not titles; see Guardrails section below; empty/missing throws at startupSitefinity-SfW2L:CustomFieldPrefix- required; if a field name contains00Nand starts with this prefix, the prefix is stripped before sending to SalesforceSitefinity-SfW2L:AllowedCompanies- optional but recommended; comma-separated whitelist forcompanySitefinity-SfW2L:AllowedLeadSources- optional but recommended; comma-separated whitelist forlead_sourceSitefinity-SfW2L:Debug- optional; when true, sends debug flags to Salesforce
3. Initialize in Sitefinity
Initialize in Global.asax - Sitefinity method - Bootstrapper_Bootstrapped
private void Bootstrapper_Bootstrapped(object sender, EventArgs e)
{
// add webhook form submission events after Sitefinity has bootstrapped
Sitefinity.Salesforce.WebToLead.SalesforceWebToLeadHook.Init();
}
Or under Global.asax - Application_Start:
protected void Application_Start(object sender, EventArgs e)
{
Bootstrapper.Initialized += (s, args) =>
{
if (args.CommandName == "Bootstrapped")
{
Sitefinity.Salesforce.WebToLead.SalesforceWebToLeadHook.Init();
}
};
}
4. Custom Fields (Salesforce + Sitefinity)
Salesforce exposes custom Web-to-Lead fields as IDs like 00N.... Sitefinity does not allow form field names that start with a number, so use a prefix and let the hook strip it before sending.
Example:
- Salesforce field ID:
00NABC123xyz - Sitefinity field name:
sf_00NABC123xyz web.configsetting:Sitefinity-SfW2L:CustomFieldPrefix=sf_
Only field names that contain 00N and start with the configured prefix will have the prefix removed.
Quick reference: Salesforce Setup → Web-to-Lead → "Create Web-to-Lead Form" shows the field names and the 00N... IDs.
5. Create or Update a Sitefinity Form
Create or update a Sitefinity form so it includes the required Lead fields and uses the correct Salesforce field names.
Required fields (per default Lead validation in this library):
last_namecompanyemaillead_source(use a hidden field with a fixed, allowed value)
For custom Salesforce fields, use the 00N... IDs and apply the configured prefix if Sitefinity blocks leading numbers (for example, sf_00N...).
Key Design Decisions
1. Project Structure
Separate Class Library (.NET Framework)
Example name:Sitefinity.Salesforce.WebToLeadReferenced by the Sitefinity web project
Initialized during Sitefinity bootstrap (not raw Application_Start)
2. Salesforce Integration
Endpoint:
https://webto.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8Required hidden fields:
oid(Org ID)
Optional:
debug=1
3. Field Mapping Strategy
No internal mapping dictionary
Sitefinity form editors control Salesforce field names via:
Form -> Edit Field -> Advanced -> FieldNameField Names must match:
- Salesforce standard Web-to-Lead names (
email,first_name, etc.) - OR custom Lead field IDs (
00N...) - Find and generate correct field names in Salesforce Setup → Web-to-Lead → "Create Web-to-Lead Form"
- Full instructions: open Salesforce Setup, search for "Web-to-Lead", click "Create Web-to-Lead Form", then copy the generated field names/IDs into Sitefinity form field names
- If Sitefinity won't accept a leading number, set a prefix (see
CustomFieldPrefix) and name the field likesf_00N...
- Salesforce standard Web-to-Lead names (
Hidden field
lead_sourcerequired in each formUnmapped fields will be discarded upon submission
Guardrails Implemented in Code
Required Fields (hardcoded)
The following fields are typically required by default on Salesforce leads lists
So the library will require, at minimum these fields
string[] RequiredLeadFields = { "last_name", "company", "email", "lead_source" };
Form Whitelist (AppSettings)
Only fires if form slug is explicitly allowed. Find form slugs in Sitefinity → Content → Forms → Form → "Title & Properties" window → Advanced options
Allowed lead_source Values
lead_sourcemust:- be supplied by the form (use a hidden field)
- match a configured whitelist
Note: For the
lead_sourcehidden field, the whitelist of allowed values will prevent a user from changing the default value coded for the form
Allowed company Values (optional)
- When configured,
companymust match a configured whitelist - Recommend to use a hidden field with a hardcoded default, in the case
companyis not specifically required for the form data collection - If you use a hidden field, the whitelist will prevent users from changing the default allowed value
Webhook Endpoint
- Read from
web.config - Default Salesforce web-to-lead endpoint looks like - https://webto.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8&orgId=00xx
Async Behavior
Uses fire-and-forget async Task
Does not block Sitefinity form submission
Failures are logged only (UX unaffected)
License
This project is licensed under the MIT License. See LICENSE.txt for the full license text.
Changelog
0.0.5.7
- Corrected the assembly version so the published package metadata matches the intended release after the
0.0.5.6tag/push used stale assembly info. - No library code changes beyond the release version correction and documentation update.
0.0.5.5
- Disabled the GitHub Actions step that unlisted package versions immediately after publishing to NuGet.org.
- Prepared the next listed NuGet release after the
0.0.5.4publish/unlist issue.
0.0.5.4
- Improved project documentation and README content.
- Updated the website-facing and technical readmes for clearer installation, release history, and project positioning.
0.0.5.3
- Added support for Salesforce custom Web-to-Lead field IDs using a configurable prefix such as
sf_00N..., with automatic prefix stripping before submission. - Updated documentation for the custom field prefix workflow.
0.0.5.2
- Improved README installation instructions for package consumers.
- No library code changes in the tagged diff beyond the release version update.
0.0.5.1
- Added
LICENSE.txtandREADME.mdto the NuGet package. - Refined package metadata and publish workflow for package consumers.
0.0.5.0
- Updated the NuGet publish workflow for the
0.0.5.xrelease line. - No library code changes in the tagged diff beyond the release version update.
0.0.4.9
- Updated the NuGet package identity in the
.nuspec. - Expanded README guidance related to package installation and usage.
0.0.4.8
- Simplified the NuGet publish workflow configuration.
- No library code changes in the tagged diff beyond the release version update.
0.0.4.7
- Refined the NuGet publish workflow again as part of release automation hardening.
- No library code changes in the tagged diff beyond the release version update.
0.0.4.6
- Continued refining the NuGet publish workflow.
- No library code changes in the tagged diff beyond the release version update.
0.0.4.5
- Continued refining the NuGet publish workflow.
- No library code changes in the tagged diff beyond the release version update.
0.0.4.4
- Updated the GitHub Actions workflow to add and refine NuGet publishing support.
- No library code changes in the tagged diff beyond the release version update.
0.0.4.3
- Refined the publish workflow for the NuGet release pipeline.
- No library code changes in the tagged diff beyond the release version update.
0.0.4.2
- Refined the publish workflow for NuGet automation.
- No library code changes in the tagged diff beyond the release version update.
0.0.4.1
- Expanded the GitHub Actions publish workflow for NuGet packaging.
- No library code changes in the tagged diff beyond the release version update.
0.0.4
- Updated the project for NuGet builds.
- Added
NuGet.configandpackages.configto support packaging workflows. - Refined the
.csprojDLL referencing strategy for Sitefinity builds.
0.0.3
- Initial tagged release of the Sitefinity Forms to Salesforce Web-to-Lead integration.
- Included the core hook logic, README updates, NuGet
.nuspec, and publish workflow groundwork.
Sitefinity DLL Referencing Strategy
Class Library (.NET Framework 4.7.2 / 4.8)
Reference exact Sitefinity DLL versions used by the site
Do not install Sitefinity via NuGet
Recommended approach:
/lib/sitefinity/14.4/bin/*.dll/lib/sitefinity/15/bin/*.dllBuild two binaries from the same codebase:
One compiled against SF 14.4
One compiled against SF 15
Deploy matching DLL to matching site version
Build Release for testing in a real Sitefinity webapp (use Debug only when actively stepping through code)
Why Not Sitefinity Service Hooks?
Service Hooks POST JSON
Salesforce Web-to-Lead requires application/x-www-form-urlencoded
No body templating → requires transformer → defeats “no extra service” goal
Final Outcome
Replaces dead Salesforce connector
Zero dependency on Progress maintaining anything
Minimal infrastructure
Works on 14.4 and is currently working and tested on Sitefinity 15
Editor-controlled field mapping with admin guardrails
Production-safe async behavior
Support
View project page here - https://computerkick.com/sitefinity-forms-to-salesforce-webtolead/
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET Framework | net48 is compatible. net481 was computed. |
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.