This guideline is part of a three-step process:
- Connecting Surveypal to Salesfore
- Selecting user profile and root object in Salesforce
- Mapping survey responses to Salesforce
Mapping responses to Salesforce object's fields
The mappings define how to map survey responses to Salesforce. In the mapping view, you can define how answers to different survey questions are used to populate the Salesforce object's fields. In the example below an answer to survey question "Open feedback" is mapped to Description in Salesforce.
In addition to question input, it is possible to map constant custom values to Salesforce. This value will be always be the same. This can be used for example to change Status to "Closed". Since Status has a limited set of possible values, there's a tooltip reminding about this fact.
Creating related Salesforce objects
In addition to using the root object's fields, it is also possible to create or update related objects that are related to the root object. Related objects can be found in the field dropdown below the root object's fields. The label consists of the name of related object and the name of the relationship. E.g. Case has a relationship with Event and name for that relationship is "Events".
In this example, Case can have a relationship with a custom object called "Feedback". In the example below, survey questions are mapped to Feedback object's fields. By default, the integration will now:
1) create or update a Case, and give it status "Closed",
2) create a new Feedback instance that gets values from the survey questions
Let's now save the integration and see what it does. We can use the anonymous link found in Distribute view to test it.
New Case and Feedback objects are created by the integration in Salesforce.
Using the survey link to connect survey responses to Salesforce objects
In most use cases, it's preferable to update an existing object instead of creating a new one. This can be achieved by connecting each survey response to an existing Salesforce object. In root object setup we did something like this:
To link a survey response to a certain Case, there must be metadata called "sf_case" for the response. In the mappings view, there's a survey link that can be used to achieve exactly this:
Here's what the full link looks like:
https://my.surveypal.com/app/form/ext?sid=633658907&sh=Dqp0o1VpAWXGbeajWBGKstrzqlS7DskHpS03uKe9XVN6BoL-nnQhpYRJWvXfovew&source=external&meta=[{'key':'sf_case','value':'{!Case.Id}'}]
The interesting part for the integration is the meta parameter at the end:
&meta=[{'key':'sf_case','value':'{!Case.Id}'}]
This is the part that will create the metadata "sf_case" whenever the link is used. The placeholder {!Case.Id}
is naturally not a valid ID, but it must be replaced when sending the link through Salesforce. Salesforce documentation about merge fields tells how to use this kind of placeholders.
After the placeholder has been filled, the meta parameter looks similar to this:
&meta=[{'key':'sf_case','value':'1234J00001GH5wZ'}]
Using that link, a new response is created with metadata {sf_case: '1234J00001GH5wZ'}
every time a response is submitted. This value is used to find the correct Salesforce object to update.
Survey question input can also used as source for the identifier (e.g. email address).
Edit integration link
You can add more meta information or external id to the link if you want.
Here we have second meta information sf_account which takes value from field Account.Id
&meta=[{'key':'sf_case','value':'{!Case.Id}'},{'key':'sf_account','value':'{!Account.Id}'}]
When you add Salesforce field placeholders to the link, syntax is different if you use Marketing Cloud or Pardot. For example placeholder {!Case.Id} look like this %%Case.Id%%