Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This demonstrates how to use S4S Cloud send2crm to identify a website visitor against an existing Lead. In this example we send out an email to Leads that already exist in Salesforce, but are not yet identified as S4S Cloud send2crm visitors.

The individual link may be something like:

...

Info

This example uses a Lead, but it could be any other standard or custom object. See Custom Identification Object for more details.

Create Mapping

Create an S4S Cloud a send2crm Mapping in Salesforce.

  • Set the Form Identifier to formId:<custom_id_here>.

  • Set the Salesforce Object to Lead.

  • Check the Update Only box.

  • Set the Identification Lookup to Lead.

...

Add script to the website to take the value from the URL parameter and submit it via S4S Cloudsend2crm.

Code Block
languagejs
// Do not act until the document is loaded.
window.addEventListener('load', (evt) => {
  // Get the leadid parameter from the URL.
  let urlParams = new URLSearchParams(window.local.search);
  if (urlParams.has('leadid')) {
    // Create object with field values - this should match the data accessor in the mapping.
    let formData = { leadid: urlParams.get('leadid') };
    // Send the form data via S4S Cloudsend2crm, using the formId that matches the mapping.
    S4SCloudsend2crm.forms.send('lead_identifier', formData)
      .then((data) => {
        // Successful response. S4S Cloudsend2crm will apply the visitor id automatically.
        // Show a success message, or do something else.
      })
      .catch((error) => {
        // Failed :-(
        // Perhaps surface an error?
      });
  }
}

...