WordPress.org

Plugin Directory

WordPress-to-lead for Salesforce CRM

WordPress-to-Lead for Salesforce CRM creates a solid integration between your WordPress install(s) and your Salesforce.com account!

= Examples: http://jqueryui.com/datepicker/

=

= API Reference: http://api.jqueryui.com/datepicker/

= How do I find the "internal name" of my picklist field?

Hint: Use the form importer!

Picklists in SalesForce (Web to Lead at least) are a strange beast -- you'd think you could pass the field name and SF would map it on their end... but they don't make it that easy. Instead you need to use the internal SF ID of the picklist... which looks more like: 00Nd0000007p1Ej (this is just en example, this is not the id of your field).

Where do you find this cryptic value? You can find it in two places (that I know of):

  1. Edit the field and it'll be in the URL: e.g. https://na14.salesforce.com/00Nd0000007p1Ej/...

  2. Generate a Web to Lead form with your field included and it'll be in the HTML e.g. TestPicklist: <select id="00Nd0000007p1Ej" name="00Nd0000007p1Ej" title="TestPicklist">

Then take the "name" you get (00Nd0000007p1Ej in this example) and enter that as the field name in your form editor. Yes, you enter this obtuse string of digits instead of the human readable field name (i.e. MyCustomField__c).

How do I use the HTML field?

  1. Optionally enter a label (field will display full width if a label is not entered.
  2. Enter HTML code in the options box.

Note: You cannot use the HTML box to enter a custom field, as only "known" fields are submitted to salesforce and HTML fields are not submitted (just displayed). Be careful to avoid the <form> or </form> tags in an HTML field as they will likely break your form.

How do I use a lookup field with a picklist field in the plugin?

Hint: Use the form importer!

Since it's a lookup field the value of the options has to be SalesForce's internal id, not the value you'd think it would be. Otherwise when Jane Doe gets married and becomes Jane Smith you'd break all the links to her user.

Basically, you need to generate a Web to Lead form in Salesforce and grab the option values from the HTML it generates.

e.g.

Find the lookup field. This is the bit you're looking for:

<option value="00Nd0000007p1Ej">Joe Schmoe</option>
<option value="00Nd0000007p1aB">Jane Doe</option>

...

00Nd0000007p1Ej (just an example) is the SF internal ID for that choive. Enter that as the value in your pick list field options like this:

00Nd0000007p1Ej:Joe Schmoe|00Nd0000007p1aB:Jane Doe

How do I change the order of input fields?

Right now, the only way of ordering input fields is by changing the position numbers on the right hand side of the input fields table in the admin settings. Drag and drop re-ordering is on the roadmap.

How do I apply my own styling to the form?

Instructions for disabling or overriding the CSS are included on the plugin settings screen (see Style Settings).

What does "Use WPCF7 CSS integration" do?

This option adds the WPCF7 classes to the form fields so you get the WPCF7 CSS styles applied (if that plugin is also activated).

Is it possible to make multiple forms with this plugin?

Yes, version 2.0 introduces this feature. Version 2.1 allows you to duplicate forms to reduce re-entering data. Version 2.5 allows you to import Web-to-Lead forms from Salesforce.

How do I change the Lead Source that shows up in Salesforce?

You can easily change this by going into the WordPress-to-Lead admin panel and, under form settings, changing the Lead Source for that form. Daddy Analytics uers can set this to blank to have it automatically filled.

I want to include the full URL the form is embedded on, but SF limits the lead source to 40 characters -- how would I do that?

The lead source supports using %URL% as the lead source (which will be replaced with the form embed url), but SF inexplicably limits the lead source to 40 characters.

Here's how to route around that:

/*
How to use:
1. Create a custom URL field at SalesForce (or Text field that holds more than 255 characters if you desire). A URL field makes it clickable in the lead detail view(s).
2. Replace URL_CUSTOM_FIELD_NAME below with the name of the custom field you setup in SalesForce,
   it will be something like EmbedUrl__c
3. Add a hidden field to each form with the same field name (e.g. "EmbedUrl__c")
4. Profit
*/

add_filter( 'salesforce_w2l_field_value', 'salesforce_w2l_field_embedurl', 10, 3 );
function salesforce_w2l_field_embedurl( $val, $field, $form ){

    // Target a specific field on all forms
    if( $field == 'URL_CUSTOM_FIELD_NAME' )
         $val = esc_url("http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);

    return $val;

}

https://gist.github.com/nciske/10047552

Can I change the submit button?

Of course you can! Go into the WordPress-to-Lead admin panel and, under Form Settings, change the text from the default "Submit" to whatever you'd like it to be!

Will I lose data if I upgrade to 2.0? Do I need to change anything?

Nope! The plugin will migrate your existing data to the new format. Your existing form will become Form 1 and be output by the [salesforce] shortcode).

How do I show my other forms?

Just use [salesforce form="X"] (X is the form number). Or select a form number in the widget.

I put my campaign name in the Campaign_ID field but it's not working

The Campaign_ID field requires the Campaign ID -- the name will not work. To find the Campaign_ID, go your the campaign page and look in the URL bar for the ID:

e.g. https://salesforce.com/621U000000IJat

In this example, 621U000000IJat is the Campaign_ID -- make sure you use the ID from the campaign you want the lead attached to and not the example ID shown here.

Does the return/thanks URL have to be on my site?

No, as long as it's a valid URL it will work. However it should be an absolute URL regardless of where it is located. e.g. http://yoursite.com/thanks/ not just /thanks/

Is there a limit to how many leads can be captured?

While the plugin has no limits, SalesForce does limit API calls per day:

The daily limit for Web-to-Lead requests is 500. If your organization exceeds its daily Web-to-Lead limit, the Default Lead Creator (specified in the Web-to-Lead setup page) receives an email containing the additional lead information.

See also: How many leads can we capture from our website?

Can I hide the admin message insisting I enter my organization id?

Yes. Be careful -- that's there to remind you that the plugin doesn't do much without one.

Add this to functions.php or a custom plugin (see other notes for more detailed instructions):

add_filter( 'salesforce_w2l_show_admin_nag_message', '__return_false', 10, 1 );

Filters and Hooks

Note:

  • These should be placed in your active theme functions.php or a functionality plugin.
  • Never edit a plugin directly (unless you understand the implications of doing so).
  • You can use Pluginception to create a custom plugin for these to make them independent of your theme: https://wordpress.org/plugins/pluginception/

Filters

salesforce_w2l_api_url

Change the API url the plugin posts data to. Passes the form type (lead or case)

add_filter( 'salesforce_w2l_api_url', 'my_w2l_api_url', 10, 2 );

function my_w2l_api_url( $url, $form_type ){
    return 'https://my.custom-api-url.com/something/';
}

sfwp2l_validate_field

Provide your own validation logic for each field.

An error array is passed in, along with the field name, submitted value, and field configuration (type, default value, required, etc).

Here's an example of blocking common free email providers:

add_filter('sfwp2l_validate_field','block_non_biz_emails', 10, 4);

function block_non_biz_emails( $error, $name, $val, $field ){

    if( $name == 'email' ){

        $non_biz_domains = array( 'gmail.com', 'yahoo.com', 'hotmail.com', 'aol.com' );

        $domain = array_pop(explode('@', $val));

        if( in_array( $domain, $non_biz_domains ) ){
            $error['valid'] = false;
            $error['message'] = 'Please enter a business email addresss.';
        }

    }

    return $error;
}

You can add to the $non_biz_domains to block other providers as well.

salesforce_w2l_form_html

HTML of the form before it's returned to WordPress for display

salesforce_w2l_cc_user_from_name

Change from name (user confirmation)

salesforce_w2l_cc_user_from_email

Change from email (user confirmation)

salesforce_w2l_cc_admin_from_name

Change from name (admin notification)

salesforce_w2l_cc_admin_from_email

Change from email (admin notification)

salesforce_w2l_cc_admin_email_list

Adding this code to your functions.php file will add 3 emails to the list. You can add as many as you want and each will get an admin notification email.

add_filter('salesforce_w2l_cc_admin_email_list','salesforce_add_emails');

function salesforce_add_emails( $emails ){

//uncomment line below to remove site admin
//unset($emails[0]);

$emails[]='email@domain.com';
$emails[]='email2@domain.com';
$emails[]='email3@domain.com';

return $emails;
}

salesforce_w2l_cc_user_email_content

salesforce_w2l_cc_admin_email_content

Allows you to filter (append, prepend, modify) the email message content sent to the user or admin(s).

add_filter('salesforce_w2l_cc_user_email_content','salesforce_filter_user_message', 10, 1);

function salesforce_filter_user_message( $message ){

    $message = 'Before the user message' . "\r\n\r\n" . $message . "\r\n\r\n" . 'After the user message';

    return $message;

}

add_filter('salesforce_w2l_cc_admin_email_content','salesforce_filter_admin_message', 10, 1);

function salesforce_filter_admin_message( $message ){

    $message = 'Before the admin message' . "\r\n\r\n" . $message . "\r\n\r\n" . 'After the admin message';

    return $message;

}

salesforce_w2l_returl

salesforce_w2l_returl_{Form ID}

Allows you to filter the value of a field before it is output to dynamically populate it with a value, auto set it based on another value, etc.

Examples:

// Filter Return/Success URL on a specific form
// salesforce_w2l_returl_{Form ID}
add_filter( 'salesforce_w2l_returl_1_tester', 'salesforce_w2l_returl_1_tester_example', 10, 1 );
function salesforce_w2l_returl_1_tester_example(  $returl ){

    return 'http://123.com';

}

salesforce_w2l_success_message

salesforce_w2l_success_message_{Form ID}

Allows you to filter the contents of the success message before it is output to dynamically populate it with a value, auto set it based on another value, etc.

Examples:

// Filter Success Message on a specific form
// salesforce_w2l_success_message_{Form ID}
add_filter( 'salesforce_w2l_success_message_1_tester', 'salesforce_w2l_success_message_1_tester_example', 10, 1 );
function salesforce_w2l_success_message_1_tester_example(  $success ){

    return 'Testing 123';

}

salesforce_w2l_field_value

salesforce_w2l_field_value_{Form ID}_{Field Name}

Allows you to filter the value of a field before it is output to dynamically populate it with a value, auto set it based on another value, etc.

Note that the second filter requires you to replace {Form ID} and {Field Name} to be replaced with the relevant form id and field name.

If you need access to the field or form settings in your filter you can use:

$field = salesforce_get_field( $field_name, $form_id );
$form = salesforce_get_form( $form_id );

Examples:

salesforce_w2l_form_action

Allows you to remove the form action.

// Remove Form Action
add_filter( 'salesforce_w2l_form_action', 'salesforce_w2l_form_action_example', 10, 1 );
function salesforce_w2l_form_action_example(  $action ){

    return '';

}

salesforce_w2l_lead_source

Allows you to alter the lead source (per form or globally).

// Alter Lead Source
add_filter( 'salesforce_w2l_lead_source', 'salesforce_w2l_lead_source_example', 10, 2 );
function salesforce_w2l_lead_source_example(  $lead_source, $form_id ){

    if( $form_id == 1 )
        return 'Example Lead Source for Form #1 on page id #'.get_the_id();

    return $lead_source;

}

salesforce_w2l_post_args

Allows filtering of the wp_remote_post arguments (e.g. extend the timeout, increase redirect limit, etc).

add_filter( 'salesforce_w2l_post_args', 'salesforce_w2l_post_args_example' );

function salesforce_w2l_post_args_example( $args ){

    $args['timeout'] = 10; // http timeout in seconds
    return $args;

}

salesforce_w2l_post_data

Allows filtering of the post data before it is sent to SalesForce.

add_filter( 'salesforce_w2l_post_data', 'salesforce_w2l_post_data_example', 10, 3 );

function salesforce_w2l_post_data_example( $post, $form_id, $form_type ){
    error_log( 'POST ARGS = '.print_r( $post, 1 ) );
    $post['test'] = 'test';
    return $post;
}

salesforce_w2l_show_admin_nag_message

Suppress the organization id missing nag message (return false).

add_filter( 'salesforce_w2l_show_admin_nag_message', '__return_false', 10, 1 );

Actions

salesforce_w2l_before_submit

Allows you to do something (read only) with the post data before it's submitted to SalesForce.

e.g. Send it to another API, log it to a database, etc.

If you need to change the data, use the salesforce_w2l_post_data filter.

add_action('salesforce_w2l_before_submit', 'salesforce_w2l_before_submit_example', 10, 3 );

function salesforce_w2l_before_submit_example( $post, $form_id, $form_type ){
    error_log( 'BEFORE SUBMIT '.print_r($post,1) );
}

salesforce_w2l_error_submit

Allows you to do something (read only) with the post data when there is an error submitting to SalesForce.

e.g. Notify someone via email, log it somewhere, etc.

add_action('salesforce_w2l_error_submit', 'salesforce_w2l_error_submit_example', 10, 4 );

function salesforce_w2l_error_submit_example( $result, $post, $form_id, $form_type ){
    error_log( 'ERROR SUBMIT ' . print_r($result,1) );
}

salesforce_w2l_after_submit

Allows you to do something (read only) with the post data after it's submitted to SalesForce.

e.g. Send it to another API, log it to a database, etc.

add_action('salesforce_w2l_after_submit', 'salesforce_w2l_after_submit_example', 10, 3 );

function salesforce_w2l_after_submit_example( $post, $form_id, $form_type ){
    error_log( 'AFTER SUBMIT '.print_r($post,1) );
}

Requires: 3.5.2 or higher
Compatible up to: 4.0.1
Last Updated: 2015-4-20
Active Installs: 7,000+

Ratings

4.5 out of 5 stars

Support

24 of 31 support threads in the last two months have been resolved.

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1 67,3,2 100,2,2 100,1,1
0,1,0
100,1,1
100,1,1 100,1,1
100,1,1
100,1,1
0,1,0
100,1,1 50,8,4
33,3,1
0,1,0
100,1,1 100,1,1
100,1,1
100,1,1
100,1,1
100,1,1 100,1,1
100,1,1 100,1,1
100,1,1 0,1,0
0,1,0
100,1,1
100,2,2