• Pavani Bhasutkar
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Hello,
I created a very simple trigger to add a Note when a Lead is created. The Note is not getting added, what am I doing wrong? (Code below) Is it not working because the Lead is not yet created? With an After Insert this shouldn't matter though. Notes are turned on and are working to manually create them.
Thanks,
Ryan
trigger AddNote on Lead (after insert) {
	List<Note> addnte = new List<Note>();
        for(Lead lds : Trigger.new){
            Note addedntes = new Note();
            addedntes.ParentId = lds.Id;
            addedntes.Body = lds.Sales_Notes__c;
            addedntes.Title = 'Creation Note';
            addnte.add(addedntes);
        }
    if(addnte.size()>0){
        insert addnte;
    }
}