Response mappings merge data returned from a page processor (from an import or a lookup) into the original export’s data, so that the new data can be used in steps later on in the flow. Response mappings always occur at the record level.
This example uses the following steps:
- Export campaign folders from Mailchimp.
- Look up email campaign information.
- Import the email campaign data into Salesforce.
If you have Mailchimp email campaign data that you want to import into Salesforce, you can first extract all campaign folders with a Mailchimp export, then use a lookup from another Mailchimp resource to add information to the export data. Then you can use response mapping to send the aggregated data to Salesforce.
Click the + icon on the lookup step to configure the lookup.
This lookup uses an alternate connection to a different Mailchimp account to retrieve information to add to the initial export data. You can define your secondary search criteria in the What would you like to export? section.
For this example, choose the Campaigns API and use a Get all campaigns operation to retrieve the secondary lookup data. Click Launch under Configure search parameters to open the Search parameters window and further refine the search.
The options in this window vary from service to service depending on the API's available fields. You can use the settings to further refine the data retrieved by the lookup. For this example, the lookup will only return records with a Campaign type field value of "regular".
Once you have refined your search criteria, you can verify the lookup returns data as expected by clicking the Preview button in the Preview data panel.
This lookup retrieves all campaigns with a value of "regular" in the "type" field.
Response mappings are set with the mappings icon ( ) to the right of an import or lookup step that also has another step following it. Click the plus icon on the lookup or import step to add it if it isn’t visible.
Once you export the data from Mailchimp, configure the response mappings:
The response mappings for Mailchimp lookups allow the following four options:
- data: exportsdata included in the response from mailchimp.
- errors: exports any errors from the processed record.
- ignored: exports a “true” or “false” value. The value is "true" if the record processed through this import step was ignored. Otherwise the value is "false".
- statusCode: exports the status code that resulted from processing the record through this import step.
All of this data is merged into the source export’s data object as a new field. The Source record field (New/Existing field) on the right is for choosing a field name to hold the data that will be added to the export data for use later on in the flow. If you use a name that is already a field on the top level of the source data’s JSON object, this response mapping overwrites that field. If you use a new name, a new field is added to the source data.
In the above example, the "data" field from the lookup response is mapped to a field named "regular_campaign".
You can configure an unlimited number of further lookup or import steps with response mappings as needed to use in further steps.
In additional lookup steps, the data will be merged into the original export in whatever field name you choose to store the values.