• Melinda Grad
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
I have a before delete trigger on Topic Assignment that I'm using to block a User from deleting a Topic from a Question in a lightning community. The trigger works fine and blocks the DML, however the error message is not User friendly and I cannot figure out how to get it to display ONLY my error message.
What's odd is that it seems to work for Trigger.new. Help is appreciated.

trigger TopicAssignmentTrigger on TopicAssignment (before delete) {
for(TopicAssignment ta : Trigger.old){
//Conditional logic will go here
ta.addError('CANNOT DELETE THIS TOPIC'); }
}

User-added image
I have a before delete trigger on Topic Assignment that I'm using to block a User from deleting a Topic from a Question in a lightning community. The trigger works fine and blocks the DML, however the error message is not User friendly and I cannot figure out how to get it to display ONLY my error message.
What's odd is that it seems to work for Trigger.new. Help is appreciated.

trigger TopicAssignmentTrigger on TopicAssignment (before delete) {
for(TopicAssignment ta : Trigger.old){
//Conditional logic will go here
ta.addError('CANNOT DELETE THIS TOPIC'); }
}

User-added image