-
Notifications
You must be signed in to change notification settings - Fork 19
Interaction Mappings
- Managing Interactions Mappings
- Interaction Mappings Advanced Functionality
- Interaction Mappings Errors
- Connect an Additional Object
The Interaction Mapping custom object contains records that support Interactions. The code uses these records to determine where to map data from the Interaction to any objects supported in the code. The code supports mapping fields from Interactions to the following objects:
- Leads
- Contacts
- Opportunities
- Campaign Members
- Affiliations
The code also supports mapping fields from Leads to Interactions when an existing Lead is found for an Interaction with “Lead Only” set to false. This prevents information from being lost on converted Leads during the Interaction process, and allows those fields to be mapped directly to other supported objects, like Contacts, Opportunities, Affiliations, or Campaign Members.
Interaction Mapping records make it possible to create additional fields for any of the above objects without updating the Apex code driving the Interaction process. All that is required is an Interaction Mapping record, a field to map from, and a field on the target object to map to. The package includes a sample data file with a tab for suggested Interaction Mapping records, but an administrator can choose to add additional records, update records to map to different fields, or remove records according to business processes and requirements.
The following fields are included on the Interaction Mapping record:
Field | Field Type | Notes |
---|---|---|
Target Object API Name | Picklist | The API Name of the object the record maps to |
Target Field API Name | Text | The API Name of the field the record maps to |
Source Object API Name | Text | The API Name of the Object being mapped from. This will be Interactions__c for most records, but Lead can also be the Source Object if the Target Object is Interactions__c |
Source Field API Name | Text | The API Name of the field being mapped from, this will normally be an field on Interaction |
Active | Checkbox | The record will be ignored if this field is not checked |
Insert Null | Checkbox | Allows the insertion of a null value in the target field |
Skip Mapping | Multi-select Picklist | Determines which Interactions will ignore the mapping record based on the Interaction Source field |
Interaction Mappings allow the Interaction process to update the correct fields with data from the Interaction record (or Lead when mapping to Interactions) without requiring the mappings to be hardcoded. The package contains custom fields on each of the supported objects. A sample data file containing suggested Interaction Mappings is also provided for importing.
Adding additional fields is a simple process:
- Create field on target object(s) and grant any desired Read and Edit access for your users using Profiles or Permission Sets
- Create field on Interaction record (or Lead) and grant Read and Edit access to your users using Profiles or Permission Sets if they should be able to view and update it
- Create Interaction Mappings using the target object and field API Names and source object and field API Names and set the Active checkbox to true
- If applicable, update the standard Lead Field Mappings on the Lead object to map any new Lead fields to the appropriate Contact or Account field. Standard Lead to Opportunity mappings are not supported by Interactions. Opportunities are only updated based on fields set on the Interaction either when the Interaction is first created or from existing Leads mapped to Interaction during the process.
An Interaction Mapping record must be created for each target field the Interaction (or Lead) field is being mapped to. Different types of fields can be mapped to each other within certain boundaries. Keep the following in mind, and learn more about field types by reading Salesforce’s Custom Field Types Knowledge article.
- The source field cannot have values exceeding the character limit of the target field.
- Extend the character limit or change the field type of the target field.
- Ex: Mapping a Text field to a Text Area field is not a problem, but mapping a Text Area field to a Text field may be. There is no automatic truncation, instead the code will error.
- The target field will not accept values that do not meet the Salesforce formatting requirements for its field type.
- Number, Percent, and Currency fields cannot contain letters
- Date fields must be formatted as: YYYY-MM-DD
- Date/Time fields must be formatted as: YYYY-MM-DD hh:mm:ss
- Email fields must be valid addresses
- Phone fields cannot contain letters
- Postal Code fields cannot contain letters
- URL fields must be valid web addresses
- Formula fields can write to other types of fields, if the Salesforce formatting requirements are followed.
- Ex: Career is a formula text field returning the Academic Career found on either the Academic Interest or Recruitment Interest, depending on which is filled out. This field can be mapped to a Career picklist field on Opportunity, because picklist fields accept text values.
- The following field types cannot be written to, but they can be used as the Interaction source field to write to other types of fields:
- Auto Number
- Formula
- Roll-up Summary
- Checkbox field considerations
- Checkboxes will only accept values from checkbox or checkbox formula fields. Attempting to map any other type of field to a checkbox, even if it contains 0, 1, TRUE, or FALSE, will cause the code to error.
- Be careful when mapping checkboxes, because there is no blank option, only TRUE or FALSE. If an unchecked checkbox is mapped to a checked checkbox, the field will be edited and set to FALSE, even if the intent was to ignore the field. Use the “Skip Mapping” setting to prevent this for certain Interaction Sources, or avoid using checkbox fields.
- Lookup fields are set using a valid 15-digit or 18-digit Salesforce ID. This can be done by mapping from a lookup field, formula text field, or text field on the Interaction.
- If a picklist or multi-select picklist field is set to restrict the values and the source field contains values not defined on the picklist, the code will error at that point, meaning any remaining field mappings will not be processed. If you notice inconsistencies in the way fields are being written from Interactions, this may be the reason. Either ensure the source field contains only valid values, or uncheck this restriction on the picklist.
- Lead and Interaction are the only objects that can be set as the source object, and Interaction can only be the target object if Lead is the source object.
The Interactions process uses Interaction Mappings to push values into target fields, not blanks. For example, if a Contact has a Home Phone and an Interaction matching that Contact is created that does not include Home Phone, the existing Contact’s Home Phone will not be overwritten with a blank, even though that field is mapped.
Interaction Mapping records include optional “Insert Null” business logic to bypass this feature. The Interaction process reviews all Interaction Mappings when creating or updating records, but the Active checkbox and Skip Mapping multi-select picklist business logic on Interaction Mappings can bypass this as well.
Skip Mapping functionality is not supported for Lead to Interaction Mappings.
If the Active checkbox is not checked, the Interaction Mapping will not be used by any Interaction record. This is helpful when creating additional Interaction Mappings that are not yet ready to be tested, or inactivating existing Interaction Mappings that are causing errors.
The Insert Null checkbox indicates a null value should write over a non-null field for that Interaction Mapping.
This multi-select picklist contains values matching the Interaction Source picklist on Interactions. If an Interaction is created or set to “New” with an Interaction Source matching one of the values in the Skip Mapping field, the Interaction Mapping will be ignored. Because of the dependency on Interaction Source, Lead to Interaction Mappings do not support Skip Mapping. On the following pages, we have two examples of how this functionality can be used.
Purchase lists are loaded into Salesforce as Interaction records. They sometimes include a Middle Name. This is considered important enough information to store on the Interaction record for someone to review, but the data is often messy and should not be mapped to the Contact record. However, when a user manually creates an Interaction record with a Middle Name, it should map to the Contact. To meet these requirements, the Interaction Mapping for Middle Name is created and the Skip Mapping field includes the value “Purchase List” to ensure Middle Name is not mapped for Interactions with a “Purchase List” Interaction Source.
Another common example is in handling checkboxes. By default, null fields do not overwrite fields with values in the Interaction process, but a null checkbox is not the same thing as a null text field; it could represent a legitimate value of “False.” Because of this, any Interaction containing a mapped unchecked checkbox will write over the checked checkbox it is mapped to. If a certain Interaction Source will never contain data related to this checkbox, this source should be listed in the Skip Mapping field on the Interaction Mapping record so the checkbox is not incorrectly set to “False.”
The Skip Mapping field on Interaction Mappings and the Interaction Source field on Interactions contain four default values. These can be renamed or deleted and additional values can be added to match business processes, but the values must be the same in both fields. These are the values that come out-of-the-box:
- Manual Entry
- Purchase List
- Student Information System
- Webform
Each time an Interaction Mapping is created or edited, an Apex process included in Interactions for Student Recruitment queries Salesforce to ensure the value in the Source Field API Name is valid based on the Source Object API Name selected, and the value in the Target Field API Name is valid based on the Target Object API Name selected.
In the following example, the Target Field API Name is misspelled:
If the API Name of a field included in an Interaction Mapping is changed, the related Interaction Mapping will not work and will cause the Interaction process to error. Interactions for Student Recruitment does not include functionality preventing API Names from being changed, but standard functionality will warn a user that the change could affect other processes. If the change is necessary, the Interaction Mapping must be updated afterward to prevent any issues.
It is possible to add functionality to the Interactions process by connecting an additional object. While it involves click configuration, it also requires a developer who understands the Apex code.
Please keep the following in mind when considering adding processes to the Apex code:
- Additional processes add API Calls and could slow down processing times when importing or manually creating Interactions. Always follow Salesforce Best Practices to reduce the impact and avoid hitting limits. See the Trigger and Bulk Request Best Practices and Execution Governors and Limits Developer Guide articles for additional information.
- Salesforce requires unit tests that cover a minimum of 75% of the code before it can be deployed in Production, but a higher percentage is preferred. Consider the best practices outlined in the How to Write Good Unit Tests Apex Developer Guide article.
Here are the required steps:
- Log into a sandbox environment (Apex cannot be edited directly in Production)
- Create the new object or identify an existing object
- Add fields to the object, if applicable
- Add matching fields to the Interaction object
- Update the Apex code with the additional processes
- Update the Apex test code with additional tests
- Update the Target Object API Name picklist on Interaction Mappings to include the API Name for the new object
- Create Interaction Mapping records for the fields added. See the Interaction Mappings section of the Technical Implementation Guide for more information
For more information about developing in Apex, review the following Salesforce resources: