• Brian Miller 20
  • NEWBIE
  • 30 Points
  • Member since 2016

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
Hello everyone,
I am facing a new behavior in the user debug log. I get one line such as below:
16:41:29.18 (18684983)|USER_INFO|[EXTERNAL]|00520000001LzfN|admin@ccnfr.org.ccnussb|Eastern Standard Time|GMT-04:00
for each access to a sObject field in the page, either in the VF page such as {!sObject record} OR accessed through Javascript. Problem is that I get 50+ of these lines in some busy pages and the log quits before the end at a line like this.
????????  Does anyone have the same issue?
Any idea? Is this a bug?  Can I remove these lines through the filters?  i tried all day long, with no sucess; Even setting Apex debug level to none brings these lines back.
Thansks in advance for your help.
Jerome
Hi,

I'm trying to write a trigger that will prevent the user from changing the title of an existing ContentNote.  See the code below:
trigger ContentNoteTrigger on ContentDocument (before update) {
    for (ContentDocument origCd : Trigger.new) {
        ContentDocument cd = Trigger.newMap.get(origCd.Id);
        ContentDocument oldCd = Trigger.oldMap.get(origCd.Id);
        if (cd.FileType == 'SNOTE') {  // if it is a ContentNote
            Boolean titleChanged = (cd.Title != oldCd.Title);
            System.debug('Title: ' + cd.Title);
            System.debug('Old Title: ' + oldCd.Title + ', Title changed? ' + titleChanged);
            if (titleChanged) {
                cd.Title.addError('Cannot change the title of a Usage Note! Please keep the original Usage Note title.');  // Displays an JS alert() message preventing user from saving the ContentNote
            }
        }
    }
}

In the system debug, it shows me that the old and new titles are the same:
17:51:36.0 (10540377)|USER_DEBUG|[7]|DEBUG| Title: Test title CHANGE
17:51:36.0 (10616194)|USER_DEBUG|[8]|DEBUG| Old Title: Test title CHANGE, Title changed? false
It seems like the ContentNote is already saved before the trigger is firing, hence why the old and new maps show the same Title value.

Does anyone have a different solution for this?  I tried making a trigger on ContentVersion, but it didn't help.
 
Hi,

I'm trying to write a trigger that will prevent the user from changing the title of an existing ContentNote.  See the code below:
trigger ContentNoteTrigger on ContentDocument (before update) {
    for (ContentDocument origCd : Trigger.new) {
        ContentDocument cd = Trigger.newMap.get(origCd.Id);
        ContentDocument oldCd = Trigger.oldMap.get(origCd.Id);
        if (cd.FileType == 'SNOTE') {  // if it is a ContentNote
            Boolean titleChanged = (cd.Title != oldCd.Title);
            System.debug('Title: ' + cd.Title);
            System.debug('Old Title: ' + oldCd.Title + ', Title changed? ' + titleChanged);
            if (titleChanged) {
                cd.Title.addError('Cannot change the title of a Usage Note! Please keep the original Usage Note title.');  // Displays an JS alert() message preventing user from saving the ContentNote
            }
        }
    }
}

In the system debug, it shows me that the old and new titles are the same:
17:51:36.0 (10540377)|USER_DEBUG|[7]|DEBUG| Title: Test title CHANGE
17:51:36.0 (10616194)|USER_DEBUG|[8]|DEBUG| Old Title: Test title CHANGE, Title changed? false
It seems like the ContentNote is already saved before the trigger is firing, hence why the old and new maps show the same Title value.

Does anyone have a different solution for this?  I tried making a trigger on ContentVersion, but it didn't help.
 
Hello everyone,
I am facing a new behavior in the user debug log. I get one line such as below:
16:41:29.18 (18684983)|USER_INFO|[EXTERNAL]|00520000001LzfN|admin@ccnfr.org.ccnussb|Eastern Standard Time|GMT-04:00
for each access to a sObject field in the page, either in the VF page such as {!sObject record} OR accessed through Javascript. Problem is that I get 50+ of these lines in some busy pages and the log quits before the end at a line like this.
????????  Does anyone have the same issue?
Any idea? Is this a bug?  Can I remove these lines through the filters?  i tried all day long, with no sucess; Even setting Apex debug level to none brings these lines back.
Thansks in advance for your help.
Jerome