Skip to content

Managing Interactions

Mat Ruff edited this page Jul 29, 2019 · 4 revisions

Interaction Status

The Interaction Status field on the Interaction object manages the process. To run the code, set the Interaction Status to “New.” This will run the Interaction process regardless if it is a new Interaction record or an existing one. When the code runs successfully, the Interaction Status will change to “Imported.” If something goes wrong during the process, the Interaction Status is changed to “Audit Required” and an error message is saved in the Audit Reason textbox.

Status Description
New Used to run the Interaction process for that record. If the Interaction Status is still “New” after the record has been saved, something went wrong and the code never ran. See Troubleshooting Tips.
Imported Everything processed successfully
Audit Required The Interaction was created successfully, but the code hit an error and did not fully run. An error should be displayed in the Audit Reason field.

Audit Reasons

Interaction Duplicate Error

This error only occurs when loading Interactions in a batch. This section of code prevents the process from failing when multiple Interactions in a batch match to the same Contact. It does this by concatenating First Name + Last Name + Email to create a filter key. If a second Interaction in a batch returns a duplicate filter key, the process will end for that Interaction record. It will be saved at an Interaction Status of Audit Needed, and an Audit reason matching the following:

Reason: this Interaction was not processed because it is a possible duplicate of - ' + filteredMap.get(filterKey).Id + ': ' + filteredMap.get(filterKey).First_Name__c + ' ' + filteredMap.get(filterKey).Last_Name__c + ' ' + filteredMap.get(filterKey).Email__c;

To resolve this error, an admin should find the Interaction record that matched based on First/Last Name, and Email, and decide whether to:

  1. Run it anyway by changing the Interaction Status from Audit Needed to New, either because it is not really a duplicate or it contains the best data and should overwrite the data from the Interaction it matched with
  2. Delete the duplicate Interaction and run the correct one if needed by changing the Interaction Status to New
  3. Edit fields on one of the Interactions and then run it by changing the Interaction Status to New

Opportunity Update Error

This error occurs if there is no Opportunity associated to the Interaction, but the Opportunity Key is not blank. This could be because no Opportunity was created, or an Opportunity was created and another error prevented it from being written back to the Interaction. See Troubleshooting Tips.

Reason: Interaction has an Opportunity Key, but could not find 
associated Opportunity in the system. Please verify that the 
Opportunity Key is valid.

Lead Insert Error

This error occurs when an issue prevents the process from continuing during the Lead insert step.

Reason: Error during Lead insert - ' + error.getMessage() + ‘.';

Lead Conversion Error

This error occurs when an issue prevents the process from continuing during the Lead Conversion step.

Reason: Error during Lead conversion - ' + error.getMessage()

Interaction Source

The Interaction Source field on Interaction is used to track the type of Interaction it is, whether it came from a purchased list, another database, manual entry, or other custom sources. Add options here and in the Skip Mapping multi-select picklist on the Interaction Mapping object to indicate a field should not be updated for that Interaction Source. The Interaction Source field can also be used for reporting, or to clarify for users where the data came from on a technical level. The out-of-the-box values are:

  • Manual Entry
  • Purchase List
  • Student Information System
  • Webform

Creating Interactions

Interactions can be created in multiple ways:

  • Integration/List load
  • Manually by a user from the Interaction object
  • Through Quick Actions on the Lead, Contact, Opportunity, or Campaign by a user

Integration/List Load

It is best to test the process before loading multiple Interactions through integration or a list load to ensure there are no CPU timeouts. Customizing the Interaction process by adding more steps, or including Flow, Process Builder, or outside Apex processes can slow down load times. Test a small load, then a larger one to determine if the batch size needs to be reduced. Because the Interactions code runs in batches of 200, a batch size of 200 is recommended for integration and list loads to Interactions.

Manually By a User

Any user with access to the Interactions tab can create an Interaction record there by navigating to the tab and clicking the “New” button. Only two fields are defaulted: the Interaction Status is defaulted to “New,” and the Interaction Source is set to “Manual Entry.”

Creating Interaction Manually

The most important fields to fill out are the ones included in the Duplicate Matching Rules (see Duplicate Management). By default, these fields are First Name, Last Name, and Email or Constituent ID.

Checking the Lead Only checkbox causes the process to ignore Contacts and only match on or create Leads.

Leaving both the Recruitment Interest and Academic Interest blank will result in a blank Opportunity Key and no Opportunity will be created. It is important to also fill out the Term field when setting a Recruitment or Academic Interest to ensure the Opportunity Key contains all the necessary data to match on existing records. The Opportunity Stage defaults to Inquired and can be changed if needed.

Quick Action Overview

A new Interaction can be quickly created for an existing Lead, Contact, Opportunity, or Campaign Member using an Interaction creation quick action on the Lead, Contact, Opportunity, or Campaign respectively. The quick actions are useful when the user has already found the individual in the system and needs to update data without having to determine which Opportunities to update or worry if there are other duplicate records in the system. When the Interaction is created, the full process will run and any duplicate records found will be merged automatically. Each quick action has a different layout with default values for verifying or updating. Other values can be defaulted without including them on the layout.

Lead Quick Action

The Lead quick action defaults fields from the Lead that have values. Picklist fields are not fully supported for quick actions and will not default based on their values on the Lead. The Lead Only checkbox is not included on the default layout. The fields defaulted and displayed in the quick action for the initial package are shown in the images on the following pages.

Lead Quick Action Lead Quick Action 2

Contact Quick Action

The Contact quick action defaults fields from the Contact that have values. Picklist fields are not fully supported for quick actions and will not default based on their values on the Contact. The Lead Only checkbox is not included on the default layout. The Contact fields defaulted and displayed in the quick action for the initial package are shown in the following images:

Contact Quick Action Contact Quick Action 2

Opportunity Quick Action

The Opportunity quick action defaults fields from the Opportunity and associated Contact that have values. Picklist fields are not fully supported for quick actions and will not default based on their values on the Opportunity or Contact. The Lead Only checkbox is not included on the default layout. Many of the Contact fields are defaulted and not displayed to provide a more streamlined experience. If users need to verify or update Contact fields, the Contact Quick Action should be used instead. The Opportunity and Contact fields included and defaulted in the quick action for the initial package are shown in the following image:

Opportunity Quick Action

Troubleshooting Tips

There are some common errors you may run into when the Interaction Process does not run as expected. The Audit Reasons field is designed to help, but here are some tips for narrowing down the issue quickly:

  • If the Interaction Status is at “Imported” but you notice inconsistencies in the way the fields were updated or if duplicate records were created by the process, check the following:
    • Review the data on the Interaction record involved in the process to see if it could be causing individual fields that are mapped to error (See Managing Interaction Mappings).
    • Review Duplicate Rules and Matching Rules and compare the Interaction record involved to see if it could be matching to an unexpected record (See Duplicate Matching).
  • If the Interaction Status is at “Audit Needed,” check if a Lead or Contact is associated at the bottom of the Interaction record. If not, the process hung up on matching to or creating a Lead or Contact.
    • Search for a matching Lead and/or Contact to see if there is a matching record and compare their fields to see if you can determine what information caused it. It’s possible fields are blank that are preventing duplicate matching from working, but standard Salesforce functionality is identifying the duplicate another way, like through a field that is set as unique but not in the matching criteria.
    • Look over the data to see if any required field to create a Lead or Contact is missing.
  • For “Audit Needed,” if there is a Contact and there is an Opportunity Key, check if an Opportunity is associated at the bottom of the Interaction record. If not, the process hung up on matching to or creating an Opportunity.
    • Look at the Opportunity Key Formula field on Interaction. The value will contain the part of the key following the Contact ID. If this key is missing information (like Term), the process may have trouble matching to an existing Opportunity or determining whether a new Opportunity should be created.
    • Look at other fields required on Opportunity that are not part of the Opportunity Key. If any of these are blank, the process will not be able to create an Opportunity.
    • Search for the Opportunity in Salesforce using the Last Name and Term. If an Opportunity was created but not written back to the Interaction, another system error prevented this step from occurring.

If you have read the Audit Reason and tried these tips and still cannot identify the problem, turn on debug logs and edit and save the Interaction to find more information about the issue. See the Debug Log section in the Salesforce Developer Guide for more information.

Clone this wiki locally