Implement HubSpot: Include field mapping capabilities for HubSpot
When sending for data to HubSpot, you need to provide the submitted fields with the respective values. To match the Sitefinity CMS form names with the HubSpot form names, you need to create field mapping capabilities.
To add a new column for HubSpot in the Data mapping grid of the Sitefinity CMS form:
- Create a new class that inherits the ConnectorDataMappingExtender.
Name the class HubSpotConnectorDataMappingExtender.
NOTE: The only required property is the Key property, which enables Sitefinity CMS to differentiate between the mapping extenders. Set the value to HubSpot.
- Override the DependentControlsCssClass class in case there are any fields in the Form properties that the mapping grid depends on.
For example, to fill in the field name values for HubSpot, the Form GUID field needs to be filled in first.
- Override the AutocompleteRequiredControlsCssClass class in case there are any fields in the Form properties that the autocomplete logic depends on.
For example, for the field name autocomplete function in the mappings grid to work, you first need to know the Form GUID.
- Override the GetAutocompleteData in case there is autocomplete logic for the field names.
For example, in this tutorial, you need automatic autocomplete for the HubSpot form names in the mappings grid.
EXAMPLE: For more information, see HubSpotConnectorDataMappingExtender
class from the downloaded sample.
- Register the new class in ObjectFactory.
You can do this in the initialization logic of a module, in this tutorial, a new HubSpot Sitefinity CMS module:
ObjectFactory.Container.RegisterType<FormsConnectorDefinitionsExtender, HubSpotFormsConnectorDefinitionsExtender>("HubSpot");