Here's how you can use tokens and URL parameters to automatically assign leads to Salesforce campaigns after filling out a form. These tokens work in all of the Salesforce campaign flow steps:
Add to Salesforce Campaign Change Status in Salesforce Campaign Remove from Salesforce campaign
Get the Salesforce campaign ID and status
You need two things to begin this process -- the name or ID of the Salesforce campaign you want to sync to and a valid status in that campaign. You can get the ID for the campaign by opening that campaign in Salesforce and copying the last 15 characters from the URL. Here's an example campaign URL; the ID is highlighted:
https://naX.salesforce.com/701F00230001Z9z
To get the valid statuses, click on "Advanced Setup" on the campaign's page
The status should be listed there:
Create new fields
First, you need to create two new fields -- "SFDC Campaign ID" and "SFDC Campaign Status" -- both of type "string". You can create these on your lead and contact records in Salesforce, or contact Marketo support to add those custom fields in your Marketo account.
Create or edit the form
After you create those fields, the next step is to incorporate them into your forms. Create a new form or edit an existing form, then drag those two fields into your form. Make them both hidden fields and set them to populate from a URL. If you're unfamiliar with them, this article on hidden fields has details on how they work.
Making a Field Hidden on a Form
When setting the values for those fields, use a real Salesforce campaign ID and status as the default value. Here's how you might edit the settings for those fields:
SFDC Campaign ID:
Default Value: [a real Salesforce campaign ID or name] Populate from: URL Parameter Parameter name: campaignID
SFDC Campaign Status:
Default Value: [a real Salesforce campaign status for the campaign you chose] Populate from: URL Parameter Parameter name: status
And here's what your form might look like when done:
Now you have a form that automatically add leads to the default Salesforce campaign you selected and that you can override with URL parameters.
Create a Smart Campaign
Next, you need to create a campaign that will add these leads to the selected (or default) Salesforce campaign. We'll trigger this campaign to launch whenever someone fills out your form:
In the flow, first you need to sync the lead to Salesforce so that you can add it to a campaign.
Then you can add it to the Salesforce campaign using the values in the SFDC Campaign ID and SFDC Campaign Status fields. To do this, use the tokens for those fields in your flow step: {{Lead.SFDC Campaign ID}} for the campaign name and {{Lead.SFDC Campaign Status}} for the status. If you type "{{" in the fields, the auto-suggest will help you enter that text correctly:
Your finished flow should look like this:
Finally, in the schedule tab set this campaign to run every time and activate it.
Launch your landing page
If you modified a form already in use, you can now go to that landing page, fill out the form, and watch as your lead gets synced to the Salesforce campaign you chose. If this is a new form, create and approve a new landing page which uses that form. After filling out the form, you should see the lead added to the default Salesforce campaign specified in your form:
Use URL parameters to override the default campaign and status. For our forms, the campaign is set by the "campaignID" URL parameter and the status by the "status" URL parameter. For example, this URL:
http://offers.marketo.com/offers.html?campaignID=701A00000009K3l&status=Responded
will assign the lead to the Salesforce campaign "701A00000009K3l" (the Salesforce internal ID) with the status "Responded." If either value has spaces or special characters, make sure that you URL encode them before adding them to your URL.
Using tokens in other Salesforce campaign flow steps
These tokens work in all of the Salesforce campaign flow steps -- Add, Remove, and Change Status in SFDC campaign. Follow the same directions as above but substitute the appropriate flow step in place of the Add to SFDC Campaign step.
Diagnosing errors
If your leads are not syncing to your Salesforce campaigns, first go to the Activity Log for that lead and double click the line that has the failed flow step. The information that appears will help you figure out what the problem might be.
The most common errors you'll encounter are:
Spelling errors in your tokens -- use the autosuggest to help Using an SFDC campaign ID or name that doesn't exist -- check the spelling of the campaign or ID The lead doesn't exist in salesforce -- sync the lead to Salesforce before adding him/her to your campaign Using a status that doesn't exist for that campaign -- change the status to one that does exist for the campaign, or add a new status to the campaign in Salesforce
View full article