0

I've written a basic trigger on FeedItem, which restricts users not to delete their chatter posts (simplified to clarify my question).

 trigger beforeDeleteFeed on FeedItem (before delete) {    
    for(FeedItem fi : trigger.old){            
        fi.addError('Feed cannot be deleted');
    }
 }

I'm trying to delete the post from Salesforce Classic UI.

enter image description here

I'm expecting an error message to be displayed something like this in Classic. enter image description here

But, I'm getting an error in the alert. Is this expected behavior? How do I display a meaningful message on a page instead of alert? Any inputs please?

enter image description here

2
  • Where is the record being deleted from? I find it hard to believe this is the standard UI, either Classic or Lightning. If this is custom code somewhere, you'd need to fix that code.
    – sfdcfox
    Jun 16 '20 at 0:34
  • @sfdcfox Hi there, I'm trying to delete it from standard UI (Classic UI). I just edited the question. Thanks for looking into this. Jun 16 '20 at 0:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.