Setting up a Salesforce action to pull data from your existing Salesforce records is easy!
Looking to push information from your survey to Salesforce? Check out our Salesforce Push Action Tutorial to learn how!
When Would I Use a Salesforce Pull?
When pulling data* from Salesforce you can identify a given record and pull information associated with that record. This data can then be stored, displayed, used, and reported on in Alchemer.
*When pulling data from Salesforce the pull action can populate questions on the same or later pages.
Requirements for integrating Alchemer with Salesforce:
- An Enterprise or Unlimited edition of Salesforce (these are paid accounts - our integration will not work with a Demo account)
- Alchemer Admin User
- Salesforce Admin or have access to the admin
- Must have access to the API in Salesforce
- Must know or be able to obtain your Salesforce Security Token
Set Up a Salesforce Pull Action
Follow the steps below to pull in the information you already know!
First things first, if you haven't already done so, you'll need to start by setting up the integration itself. Check out our Salesforce Integration Setup Tutorial to learn how!
Step 1. Create a survey and add the questions that you wish to populate from Salesforce.
In our example, we are going to populate three Textbox questions for First Name, Last Name and Email from the Contact object in Salesforce.
Step 2. Add a new Salesforce action. Customize your Integration Title (this is internal and not visible to respondents). Select the Salesforce Account and Salesforce Object you wish to pull from.
In our example, we will pull from the Contact object as we are populating First Name, Last Name and Email for our Contacts.
Step 3. Select Pull data from Salesforce.
Step 4. Your next step is to query Salesforce for records according to certain matching conditions. A query is the part of every Salesforce Pull action that tells Salesforce which record to use. It is both easiest and a best practice to set up queries using Salesforce identity fields. To customize the query you wish to use to pull records, simply identify the Alchemer Question that contains the data you wish to match to the specified Salesforce Field.
For advanced Salesforce users, you can click View or edit SOQL (Salesforce Object Query Language) to take your query to the next level.
In the case of our example, we'll simply identify which field in Alchemer contains the Contact ID. A common example of a query is to pull the ID that is sent as a URL variable in the survey link. This is set up below. We selected URL Variable in the Alchemer Question dropdown menu, entered the URL variable name "contactid" and then selected the Salesforce Field that it should match. This is the extent of the magic behind pulling the correct record from Salesforce!
Step 5. From here all you need to do is map your fields for prepopulation. To do so, scroll to the Fields Mapping section and map each Alchemer Question in the survey to the corresponding Salesforce Field you wish to use to populate the survey question.
To add another field to map click Add another mapping.
The Default Value field is optional. If you wish to send something other than a blank when there is no matching contact record you can enter a value in the Default Value field.
Step 6. Finally, make sure to double check the placement of your Salesforce Pull Action in relation to the questions it is populating. If you added your action after the questions you wish to populate be sure to move it to precede the questions you are going to populate.
This completes the set up for populating a survey from Salesforce. Next, you'll want to test that the integration works.
Testing Your Pull Action Setup
The steps to test your pull action setup depends on whether you have a Salesforce Sandbox Account. If you have a Salesforce Sandbox and have set it up under Account > Integrations > 3rd Party Integrations in Alchemer then you're all set to record test responses using your sandbox.
Test responses include:
- Any response recorded via the New Test Response or Invite Others to Test buttons on the Test tab.
- Any response recorded via the Invite Others to Test option in Build > Preview.
- Any response recorded via Build > Preview that is selected to be recorded.
If you do not have a Salesforce Sandbox then you'll be using your live Salesforce account to test that things are working.
The easiest way to test your pull action is to manually append the URL Variable that you are using to identify records to update to the end of your test or a live link.
The live link can be obtained on the Share tab. A test link can be obtained by going to the Test tab, clicking Invite Others to Test and sending yourself an email with a link. Once you've obtained your live or test link, copy and paste your survey link in the address bar of your browser.
Next, append the URL Variable for a given record you wish to test. To do so, go to the record within Salesforce that you wish to test. From the end of the URL for the record copy the ID.
Append the ID to the survey link as below. Notice we prepend the URL variable with a ? and the URL Variable name is identical to how we set it up in the query in step 4 above.
When this link is hit we can confirm that information is populating from Salesforce. Success!
Reviewing Individual Responses and the Action Log
If you'd like to confirm the results of your Salesforce actions you can do so within each Individual Response or in bulk in a CSV/Excel Export of your raw data.
Within an Individual Response, available under Results > Individual Responses, go to the Action Log tab. From here you can review the date and time the action was submitted, as well as the Input and Output.
This same information is available as part of a CSV/Excel Export. Go to Results > Exports > CSV/Excel and select the option to Include Action Data. This will export the date and time the action fired, the input, the output and the objectID for each Salesforce action in your survey.