When we convert the lead automatic chatter feed appears on Account. UserName converted a lead to this account.I have chatter feed enabled on Lead and Account.Is there an option to prevent this post other than disabling chatter feed on Account ?
Update :
I created the After Update trigger on Lead to delete account feed.I could get the convertedAccountID from conversion.How to access Account Feed.I see listAccountFeedsToDelete as empty in debug logs but I see feed created on Account after conversion.
trigger DeleteAccountFeed on Lead (after update) {
Set<String> convertedLeads = new Set<String>();
List<AccountFeed> listAccountFeedsToDelete = new List<AccountFeed>();
Set<Id> convertedAccountSet = new Set<Id>();
FOR(Lead l : trigger.new){
IF(l.IsConverted == TRUE && trigger.oldmap.get(l.Id).IsConverted == FALSE){
convertedLeads.add(l.Id);
system.debug('convertedLead'+l.Id);
convertedAccountSet.add(l.convertedAccountId);
system.debug('convertedAccountId'+l.convertedAccountId);
}
}
system.debug('Converted Leads size is ' + convertedLeads.size());
system.debug('convertedAccountSet'+convertedAccountSet);
IF(convertedLeads.size() > 0){
FOR(AccountFeed objFeed : [SELECT Id,Type,ParentId,(SELECT Id,FieldName FROM FeedTrackedChanges)
FROM AccountFeed WHERE Type = 'TrackedChange' and ParentId in: convertedAccountSet]){
system.debug('AccFeed....'+AccFeed);
FOR(FeedTrackedChange objChange : objFeed.FeedTrackedChanges){
system.debug('objChange...'+objChange);
IF(objChange.FieldName == 'accountCreatedFromLead' || objChange.FieldName == 'accountUpdatedByLead'){
System.debug('Account Feeds To Delete is ' + listAccountFeedsToDelete);
listAccountFeedsToDelete.add(objFeed);
System.debug('Account Feeds To Delete is ' + listAccountFeedsToDelete);
}
}
}
System.debug('Accound Feeds To Delete is ' + listAccountFeedsToDelete);
System.debug('Accound Feeds To Delete size is ' + listAccountFeedsToDelete.size());
DELETE listAccountFeedsToDelete;
System.debug('Accound Feeds To Delete is ' + listAccountFeedsToDelete);
}
}