function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Nicu TanaseNicu Tanase 

duplicate Notes on Opportunity on Lead conversion

Hi,

I am trying to duplicate Notes on Opportunity on Lead conversion.
For this i have created a trigger on Note Object : 
It looks like this: 

trigger Note_move_to_oppty on Note (before update) {
    List<Id> noteIds = new List<Id>();
    for (Note note: Trigger.new) {
        system.debug('---note.ParentId='+note.ParentId)  ;
        system.debug('---Trigger.oldMap.get(note.Id).ParentId='+Trigger.oldMap.get(note.Id).ParentId)  ;
        if(note.ParentId != Trigger.oldMap.get(note.Id).ParentId && note.ParentId.getSObjectType() == Contact.getSObjectType())        
            noteIds.add(note.Id);
    }
    if (noteIds.size() > 0) {
        Note_To_Opp_Future.insertNote(noteIds);
    }
}

But this trigger does not fire :(
Any ideas what am I doing wrong?

Thank you in advance
Vincent Ip 7Vincent Ip 7
So Lead conversion triggers are a bit confusing.  The most reliable way of implementing a Lead Conversion trigger is to create a Lead After Update trigger and check  the isConverted property.

The answer on this post goes into more detail about this

http://salesforce.stackexchange.com/questions/3956/lead-conversion-trigger-order-of-execution