How do I assign my leads to a specific campaign in Salesforce? (Custom Salesforce Integration)


Userlevel 3

UPDATE: Please read if you are using this integration.

Salesforce is about to deprecate the old web-to-lead URL around June 2017. Please make sure to update your POST URL from:

https://www.salesforce.com/servlet/servlet.WebToLead”

TO:

https://webto.salesforce.com/servlet/servlet.WebToLead”

For more information see salesforces documentation here:

https://help.salesforce.com/articleView?id=Updating-the-Web-to-Case-and-Web-to-Lead-Endpoint-URL&language=en_US&type=1

Original post:

Hey everyone,

As some of you may know, our current Unbounce to Salesforce integration is unable map your leads to specific campaigns. This is due to a limitation of the Salesforce API. Salesforce does provide an alternative which is embedding a Salesforce ‘web-to-lead’ form. However for some this may not be ideal as your data will no longer be captured on our end and the form cannot be styled using the page builder tools.

Using a method similar to Salesforce’s Web-to-lead forms you can use and retain your Unbounce forms features while sending those leads to specific campaigns.

I do need to caution this requires some knowledge of HTML or CSS. Please proceed with caution and only if you have the skillset to do so.

Steps:

Finding your Salesforce field IDs

Create a Web-to-lead form on salesforce with your required fields. We won’t be using this code but we will be using this for reference.

http://help.salesforce.com/apex/HTVie…

Be sure to include the “Campaign” field if you wish to assign the leads to a specific campaign. After you generate the code the field ID’s should be visible in the HTML.

Add the following hidden fields on your Unbounce form: retURL, oid, Campaign_ID

Give these hidden fields the same default values as in the salesforce code (set retURL to your thank you page URL)

Set your forms confirmation to ‘POST form data to URL’ and set it to the URL below:

https://webto.salesforce.com/servlet/servlet.WebToLead

Mapping your Unbounce fields to Salesforce
Salesforce is case sensitive and very particular about the field IDs. If there is even the slightest mismatch, Salesforce will ignore that field data.

You can find your salesforce field IDs in the web-to-lead code:

and on unbounce the form field IDs can be seen in the form builder. It’s the text box labelled Field Name and ID.

Uncheck the box Auto-generate from Field Label and set the value to what Salesforce requires

Now after a visitor submits your form they will be taken to your ‘thank you page’ and the lead data will be sent into Salesforce and into the proper campaign.

Hope you find this helpful! Feel free to comment below or reach out to us directly at support@unbounce.com


24 replies

This is a super-clear post thanks. I followed your steps precisely, and met with success, but the Javascript created two leads: one with full information but not in the campaign, and one with skeletal information (no email or phone but lead source miraculously included).

Any ideas about what I’m doing wrong?

Userlevel 3
Badge +1

Hi Yulia - do you have the built-in Salesforce integration enabled for the page as well? That would cause the same lead to be pushed twice with varying info. If you’re using this method, you’ll want to remove the in-app integration.

Userlevel 3

Hey Yulia - I’d be happy to take a closer look and help narrow down the issue. I’ll start a support ticket for you. Look out for my email shortly!

Very helpful support offline from Johnny, but we abandoned this approach. Much of the functionality of the standard integration is either lost, or requires lots of custom code and manual adjustments on every variant of every landing page. Way too hard / manual / error-prone. We will just put a routine into Salesforce to look for new leads with certain field values and push them into the right campaign. Appreciate the offline assistance though - plentiful and clear.

Hey, we got this to work beautifully, and have it running on several pages.

But we’ve been having trouble recently trying to the javascript to work with pre-filled forms via URLs (http://support.unbounce.com/entries/3…).

Any idea? Do you want me to send a sample, some code, etc?

Thanks!

Userlevel 3

Hey Natalie - I’d be happy to take a look and help out. I’m starting a support ticket now. Lookout for my email!

Perfect!!

Thank you so much 🙂

Userlevel 3

Anytime Natalie!

On that note, I haven’t seen a reply to my email yet. If you didn’t get anything from me try sending a email to support@unbounce.com and address it to me 🙂

Userlevel 3

Just saw your email Natalie! Hopefully you get my reply. If not let me know here and i’ll try sending you another email from my personal email

Johnny, having tried and abandoned this approach (we lost the ability to personalise the confirmation dialogue), we have come back to it, and I can report that it is working well. thank you for the clarity. A few things I learned:
1 - try all steps excluding the javascript first. Naming the hidden fields correctly in the form, and pushing to your Salesforce page does most of the heavy lifting
2 - add only those fields to your javascript that need to be translated (less is more). The Javascript is simple and powerful - it maps field names like return URL correctly.
Thanks.

Top notch post + video! Thanks.

Can we still pass the page URL this way? Or the landing page name?

Userlevel 3
Badge +1

Hi Vinnie Ð you definitely can. You’ll just need to add a hidden field and set the Default Value as your page URL or landing page name, like so: http://screencast.com/t/GE6OAW9m69Sy

Once that’s created, just add a line to the script for renaming fields in Johnny’s original post to make sure they’re getting pushed to the correct corresponding Salesforce field and you should be good to go.

Userlevel 3

Hey everyone!

We’ve made some exciting improvements to our forms which will allow this integration to be a lot more simplified safer to implement.

Our forms now allow you to separate what your field label says and what the actual Field ‘Name’ and 'ID" properties are.

It also allows you to input uppercase lettering if needed.

What this means for this custom integration is you no longer need the javascript workaround to rename your fields.

I’ve updated the main post to reflect these changes. But if you have any further questions about the improvements to our forms let us know!

What if I don’t want them to see a “Thank You” page and I just want the form dialog box to appear? I don’t want to pass my users anywhere.

Also can I still pass the Submitter IP and other Unbounce focused fields in Salesforce?

Userlevel 3
Badge +1

Hi there - in this case, when Johnny says “thank you page” he is referring to the form confirmation dialog in Unbounce.

As far as what fields you can pass, as long as you have a corresponding field in Salesforce, you should be able to map them together.

So I can expect that Unbounce is going to also pass the IP address, Unbounce Page ID, Submission Time, and Unbounce Page Varient information when I use the webhook to submit to my web-to-lead form?

Userlevel 3
Badge +1

I’m really sorry, but I actually had this mixed up with a different workaround.

So, you will have to set the retURL and fire over to the Salesforce post page, so you won’t be able to serve the form confirmation dialog.

You should be able to grab IP Address and Time Submitted, as those are pushed through on a Post to URL–you’ll need to configure your Salesforce web-to-lead so the corresponding fields are “ip_address” and “time_submitted” as that’s how they’re pushed out of Unbounce though.

Again, sorry for the confusion! I was thinking of an older workaround that used to work with a different external CRM.

Hi, Unbounce! Following the directions as supplied in this post, we’re just not seeing new leads flow into Salesforce at all. Clearly we’re missing a step, but we just can’t figure out what! Any tips on what to look for?

Hey there! It’s hard to really dive into it without actually diving into it. Would you be able to get in touch with us directly? We’d be happy to help! support@unbounce.com

Perhaps you might need to double check the field_ID case is matching your salesforce setup, as salesforce is case sensitive and very particular about the field IDs - mentioned above in the article. Hope this helps~

Thanks for the work-around documentation for this setup. I have been able to successfully create new leads and map all the appropriate lead fields into SFDC, but I still cannot get the lead to assign to the right campaign.

I’ve inserted the hidden fields retURL, oid, and Campaign_ID on the form. For Campaign_ID, I seem to be missing something about this mapping. I’ve tried using “Campaign” “Campaign_ID” and “campaign_id” for the Field Name and ID, and inserted the Option Value (number string that is at the end of the URL of the selected SFDC campaign" from the Web to Lead form. Any suggestions to troubleshoot this is greatly appreciated!

Userlevel 7
Badge +1

Hey Hollie! I’m so glad you found the workaround helpful. The issue with Campaign_ID is unfortunately a setback that has been brought up before, and we’re currently looking into it. We’ve had some conversations about it in the Community here:

We’re exploring how we can bolster our Salesforce integration, because right now we know it’s good, but we want it to be GREAT. I’ll add you to the list of individuals to inform once we’ve found a solution for this.

Thanks for chiming in here!

Userlevel 3

URGENT: Please read if you are using this integration

Hey Everyone

There’s some breaking changes to Salesforces web-to-lead integration. If you are using this integration, you’ll need to update your POST URL from this:

https://www.salesforce.com/servlet/servlet.WebToLead”

To this:

https://webto.salesforce.com/servlet/servlet.WebToLead”

For more information see Salesforces documentation here:

https://help.salesforce.com/articleView?id=Updating-the-Web-to-Case-and-Web-to-Lead-Endpoint-URL&language=en_US&type=1

Reply