Skip to main content

Return to TX Community

Liaison

Email Triggers

A Trigger is a section of code executed before or after inserting or modifying a Salesforce record based on a condition provided. There are different types of triggers based on the actions to be performed. Listed below are the triggers available in the TargetX Email package:

 

AggregateBroadcastStats
Trigger/Class AggregateBroadcastStats
Object expEmailBroadcastMembers__c
Type     after insert
Description Compiles broadcast stats from broadcast member data.
Affects TargetX_Email__expEmail_Broadcast__c.XSent__c
TargetX_Email__expEmail_Broadcast__c.XViewed_HTML__c
TargetX_Email__expEmail_Broadcast__c.XBounced__c
TargetX_Email__expEmail_Broadcast__c.XOpted_Out__c
TargetX_Email__expEmail_Broadcast__c.XInteracted__c
TargetX_Email__expEmail_Broadcast__c.XF2F_By__c
TargetX_Email__expEmail_Broadcast__c.XF2F_To__c
 
Campaign.XSent__c
Campaign.XViewed_HTML__c
Campaign.XBounced__c
Campaign.XOpted_Out__c
Campaign.XInteracted__c
Campaign.XF2F_By__c
Campaign.XF2F_To__c
How affected Updates with new value
Criteria N/A
Custom Setting N/A
Custom Setting Description N/A
Package Version 3.10 - Current


Below are common errors that are encountered with the AggregateBroadcastStats along with a resolution:

System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, TargetX_Email.aggregateBroadcastStats: execution of AfterInsert caused by: System.QueryException: List has no rows for assignment to SObject Trigger.TargetX_Email.aggregateBroadcastStats: line 4, column 1: [] 
Stack Trace: Class.AggregateContactTestSuite.TestEmailBroadcastRollup: line 112, column 1

Resolution: Email Preferences must be created. 

ConditionalContentCallForTMTrigger
Trigger/Class ConditionalContentCallForTMTrigger
Object Contact
Type     Before update
Description Executes the batch process conditionalContent to generate the location Id, content block Id pair in Contact object ,field locContentId__c. 
 
Affects Update locContentId__c field with location Id, content block Id pair
How affected  locContentId__c field is updated
Criteria  
Custom Setting Email Preferences: Enable Merged Content Blocks        
Custom Setting Description Enable_Merged_Content_Blocks__c field is set true in email preferences object
Package Version 3.25 - current


Below are common errors that are encountered with the ApplicationReviewTrigger along with a resolution:

When changing Application 'Citizenship' from International to Domestic: Apex trigger TargetX_Email.ConditionalContentCallForTMTrigger caused an unexpected exception, contact your administrator: TargetX_Email.ConditionalContentCallForTMTrigger: System.LimitException: TargetX_Email:Too many SOQL queries: 101

​Resolution: Set the Stage from Submitted to In-progress when changing the Citizenship. Then go back in and set it back to Submitted

ConditionalContentCallTrigger
Trigger/Class ConditionalContentCallTrigger
Object expEmail_Broadcast__c
Type     Before update
Description It executes the batch process conditionalContent to generate the location Id, content block Id pair in object contactLocationContent__c
 
Affects generate the location Id, content block Id pair in object contactLocationContent__c
How affected  
Criteria  
Custom Setting Email Preferences: Enable Merged Content Blocks        
Custom Setting Description Enable_Merged_Content_Blocks__c field is set true in email preferences object
Package Version 3.25 - current
 
postCreateCampaign
Trigger/Class postCreateCampaign
Object Campaign
Type     After Insert
Description Unchecks(resets) Change End Date(Change_End_Date__c)  field in campaign object upon creation of new campaign
Affects Unchecks(resets) Change End Date(Change_End_Date__c)
How affected  
Criteria  
Custom Setting Email Preferences:Auto Future Broadcast Deletion
Custom Setting Description Auto Future Broadcast Deletion  field is set true in email preferences object
 
Package Version 3.17 - current


Below are common errors (in red) that are encountered with the postCreateCampaign along with a resolution:

Array ( [0] => stdClass Object ( [errors] => Array ( [0] => stdClass Object ( [message] => TargetX_Email.postCreateCampaign: execution of AfterInsert caused by: System.DmlException: Update failed. First exception on row 0 with id 70116000001AXCpAAO; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: [] (TargetX_Email) [statusCode] => CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY ) ) [id] => [success] => ) )

Resolution: Disable the Auto Future Broadcast Deletion checkbox on the Email Preferences page.

postUpdateCampaign
Trigger/Class postUpdateCampaign
Object Campaign
Type     After Update
Description finds and deletes future broadcasts occurring after campaign end date has been modified
(find and delete all broadcasts occurring after the end of the modified campaign)
Affects deletes future broadcasts 
How affected  
Criteria  
Custom Setting Email Preferences:Auto Future Broadcast Deletion
Custom Setting Description Auto Future Broadcast Deletion  field is set true in email preferences object
Package Version 3.17 - current


Below are common errors (in red) that are encountered with the ApplicationReviewTrigger along with a resolution:

Attempting to delete a Campaign, this error displays: "Apex trigger TargetX_Email.postUpdateCampaign caused an unexpected exception, contact your administrator: TargetX_Email.postUpdateCampaign: System.LimitException: TargetX_Email:Too many query rows: 50001"

Resolution: This occurs when the number of broadcasts is greater than 50,000. User Data Loader to delete the actual broadcasts BEFORE deleting the Campaign.

 
preDeleteCampaign
Trigger/Class preDeleteCampaign
Object Campaign
Type     Before Delete
Description Deletes future broadcasts upon deletion of parent campaign
Affects Deletes future broadcasts 
How affected  
Criteria  
Custom Setting Email Preferences:Auto Future Broadcast Deletion
Custom Setting Description Auto Future Broadcast Deletion  field is set true in email preferences object
Package Version 3.17 - current
 
recordMergedRecordsId
Trigger/Class recordMergedRecordsId
Object Contact
Type     after delete
Description Documents losing merge record's ID on surviving record.
Affects mergedRecordIds__c
How affected Appends ID to string in field
Criteria MasterRecordId of losing record not null
Custom Setting Object Name: expSuitepreferences__c
Field Name: Save Merge IDs
Field API Name: TargetX_Email__expEmail_saveMergeIds__c
Custom Setting Description Save Merge Ids permits trigger's functionality to be turned on/off.
Package Version 3.1 - Current



Below are common errors (in red) that are encountered with the ApplicationReviewTrigger along with a resolution:

Error: "Apex trigger TargetX_Email.recordMergedRecordsId caused an unexpected exception, contact your administrator: TargetX_Email.recordMergedRecordsId: execution of AfterDelete caused by: System.QueryException: List has no rows for assignment to SObject: (TargetX_Email)"


Resolution: Navigate to the Email Preferences tab and Save.

recordMergedRecordsLeadId
Trigger/Class recordMergedRecordsLeadId
Object Lead
Type     after delete
Description Documents losing merge record's ID on surviving record.
Affects mergedRecordIds__c
How affected Appends ID to string in field
Criteria MasterRecordId of losing record not null
Custom Setting Object Name: expSuitepreferences__c
Field Name: Save Merge IDs
Field API Name: TargetX_Email__expEmail_saveMergeIds__c
Custom Setting Description Save Merge Ids permits trigger's functionality to be turned on/off.
Package Version 3.1 - Current


Below are common errors (in red) that are encountered with the ApplicationReviewTrigger along with a resolution:

Error: "Apex trigger TargetX_Email.recordMergedRecordsLeadId caused an unexpected exception, contact your administrator: TargetX_Email.recordMergedRecordsLeadId: execution of AfterDelete caused by: System.StringException: Invalid id: 00QC000001BGv4nMAD,00QC000001BRtJdMAL: External entry point"


Resolution/Workaround: If the TargetX_Email__mergedRecordIds__c field in the lead object is populated, save the data and clear the field. before running the merge. After the merge completes, add the data back.

 
Deprecated Email Triggers
  • handler_bounce
  • handler
  • lead_convert
  • new_contact_check
  • validate_bcast_delete
  • validate_delete_update

 

  • Was this article helpful?