Giter VIP home page Giter VIP logo

salesforce-wtl's Introduction

Salesforce WebToLead

Salesforce WebToLead - Website form to Salesforce platform

This little script helps you easily integrate the communication between your website and the Salesforce platform. You can create Salesforce leads with your existing website forms without changing their behaviour.

Usage

Download form this repository or install through npm

npm install [email protected]

Include it in your web page

<script src="/path/to/dis/salesforce-wtl.js"></script>

Now you are ready to send your leads to Salesforce.

Let's assume you have a form like this in your page

<form id="contact-form" action="/save-contact.php" method="POST">
  <label for="user-name">Name</label>
  <input id="user-name" name="username" type="text" placeholder="Your name"/>
  <label for="user-email">Your Email</label>
  <input id="user-email" name="email" type="email" placeholder="Email Address"/>
  <input type="submit" value="Submit"/>
</form>

You need to send this data to your Salesforce platform to collect leads and do some stuff but you don't want to change how your form behaves on your side.

Salesforce.init({
  action: 'https://webto.salesforce.com/servlet/servlet.WebToLead', // Salesforce Web to lead endpoint
  formId: 'contcat-form', // ID of the form to send
  mapping: { // Mapping of the local field on the salesforce platform
    'username': '<salesforce-field-name>',
    'email': '<salesforce-field-name>'
  },
  additionalFIelds: {
    '<salesforce-field-name>': '<value>'
  },
  directSubmit: true, // Send to Salesforce directly or send to Salesforce after the local form submit
  afterSubmit: function() {
    // What to do after lead sent
    alert('Sent to Salesforce')
  }
});

And that's all! ๐Ÿ‘

salesforce-wtl's People

Contributors

fatrex avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.