Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 

Preserve Chatter Files on Lead Conversion

Simple Lead trigger that moves Chatter Files to the converted Account, Contact, and Opportunity upon Lead Conversion.

You might also be interested in my blog posts about Advanced Lead Conversion using Process Builder and Preserve Related Lists and Chatter on Lead Conversion.

Deploy to Salesforce

UPDATE: Summer '17 release now preserves Salesforce Files during Lead Conversion.

As of this writing, Salesforce does not preserve Chatter or related Files during conversion operation. The Files are left orphaned.

Inspired by Gorav Seth's realization of this on Success Community, and by Matthew Souther's comment of suggested solution, I developed this simple trigger to demonstrate how to preserve and carry over the Chatter Files to the converted Account, Contact, and Opportunity.

I had originally hoped to solution this using only Process Builder and Flow, but since Salesforce already supports bringing over Enhanced Notes to the converted Account and Contact during Lead conversion, I needed to filter out all ContentDocumentLink records whose ContentDocument.FileType = 'SNOTE', something I could not readily figure out in Flow but could easily do in SOQL in Apex.

Usage

Deploy the trigger as-is, or integrate it into your own Apex trigger framework, to simply call the LeadConversionTriggerHandler class for the after update trigger event.

trigger LeadConversionTrigger on Lead ( after update ) {
    new LeadConversionTriggerHandler().handleConversion();
}

Technically, you can call the code for all events and the handler knows what to do, but minimally the after update event must be included.

About

Simple Lead trigger that moves Chatter Files to the converted Account, Contact, and Opportunity upon Lead Conversion.

Resources

License

Releases

No releases published

Packages

No packages published

Languages