Cascade Delete Visitors
Because Send2CRM allows a Visitor record to be related to more than one parent record, and to be related using custom lookup fields, some additional configuration may be required.
Disable cascade delete
By default when a Lead or Contact is deleted and the Visitor is no longer related to any other object, the Visitor record will be deleted. This includes all Visitor-related data such as Sessions and Stats because these use master-detail relationships.
Cascade deletion may be disabled by checking Disable Cascade Delete Visitors in the org-wide custom settings. This will retain Visitor and related records even when all master objects are deleted.
Cascade delete custom relationships
Lead and Contact relationships are included out-of-the-box with Send2CRM, no additional steps are necessary for these objects.
If you added a custom identification relationship and would like to cascade delete Visitor records, an additional trigger will be required.
/**
* Trigger to cascade delete Send2CRM Visitors.
*/
trigger CustomObjectCascadeTrigger on CustomObject__c (after delete) {
// Cascade delete all related Visitors, unless still related to other records.
// No deletion will occur if cascade delete is disabled by custom setting.
send2crm.VisitorHelper.cascadeDeleteVisitors(Trigger.oldMap.keySet());
}
CustomObject__c may be any custom or standard object, for example Case.
Â