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
Mike Schumacher 10Mike Schumacher 10 

trying triggers on the enhanced notes - insert trigger fires before the note is completed.

I was testing the enhanced notes in our sandbox and i noticed the insert  trigger is firing even before I finish typing.  As I type some more in the title or note body, the update triggers keep firing.  The dynamic saving as the user types is nice but I want to create a trigger to notify a specific group a new note has been added.

If I send the email notification on the insert, the new note is not complete and does not contain all the body text i entered.  The user will receive only a partial note.

How do others recommend approaching this situation?  I want to be able to capture the title and note body in an email.


Sample Trigger:
trigger Test_ContentDocument_Trigger on ContentDocument (before insert, before update, before delete,
    after insert, after update) {

    List<ContentDocument> cdRecords = trigger.new;
    ContentDocument cdRec = cdRecords[0];
    
    if(Trigger.isBefore && Trigger.isInsert) {
        System.debug('....before insert trigger....');
        System.debug('......contentdocument:' + cdRec.Title);
    }
    if(Trigger.isBefore && Trigger.isUpdate) {
        System.debug('....before update trigger....');
        System.debug('......contentdocument:' + cdRec.Title);
    }
        
    if(Trigger.isAfter && Trigger.isInsert) {
        System.debug('....before isInsert trigger....');
        System.debug('......contentdocument:' + cdRec.Title);
    }
    if(Trigger.isAfter && Trigger.isUpdate) {
        System.debug('....before isUpdate trigger....');
        System.debug('......contentdocument:' + cdRec.Title);
    }


 
Keaton Klein 13Keaton Klein 13
I've run into the same problem, no suggestions?
Sergei Wallace 11Sergei Wallace 11
bump
Mike Schumacher 10Mike Schumacher 10
Still do not have any reasonable suggestions.  Process Builder does not support the new contentdocument object yet either.