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
Juan Pablo EscobarJuan Pablo Escobar 

Trigger on note

Hi,
I created a trigger on Note and its not firing when adding a Note to any type of record (Accounts or Contacts)
A few considerations:
  1. Trigger is Active ans it's very simple(see below)
  2. The New Note feature is active on my Org
  3. I was not able to create a trigger from the UI initially so I followed this process and it worked (i didn't get an error when saving it):  https://ck-developer-salesforce-com.360casb.com/forums/ForumsMain?id=906F0000000AUhEIAW
I added debug before and after calling the trigger handler class and I see no entry on the debug lof for the NoteTriggerHandler Trigger. Suggestions ??

Thanks!!

Pablo
.........

trigger NoteTriggerHandler on Note (after insert,after update, before insert, before update) {
    NoteTriggerHandler handler = new NoteTriggerHandler();
    handler.onAfterInsertUpdate(trigger.new);
}
Best Answer chosen by Juan Pablo Escobar
Juan Pablo EscobarJuan Pablo Escobar
Thanks Gaurav. I finally got what the problem was. My trigger was set up on the old Note and Attachment object when I should have used the new enhanced note-taking tool object. For anyone experiencing the same issue please chek the following link to get involved on the data model https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_erd_contentnote.htm
I created the trigger at the ContentDocumentLink object and it is working OK now.
 

All Answers

GauravGargGauravGarg
Hi Pablo,

I followed your step in my org and created Trigger on NOTE like below
trigger NoteTrigger_AT on Note (before Insert) {

    system.assert(false, 'you are in trigger');
}


Then create a new NOTE from Account record, it hit me assertion failure. 

Could you please debug and found the stack trace from where it is failing. 

Thanks,

Gaurav
Skype: gaurav62990
Support: gauravgarg.nmims@gmail.com

Juan Pablo EscobarJuan Pablo Escobar
Thanks Gaurav. I finally got what the problem was. My trigger was set up on the old Note and Attachment object when I should have used the new enhanced note-taking tool object. For anyone experiencing the same issue please chek the following link to get involved on the data model https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_erd_contentnote.htm
I created the trigger at the ContentDocumentLink object and it is working OK now.
 
This was selected as the best answer