+ Start a Discussion
Melinda GradMelinda Grad 

Before Delete addError() message not user friendy

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

User-added image
Raj VakatiRaj Vakati
You Can't customize it too much .. its standard way of showing the error message on the standard screen.. 

Melinda GradMelinda Grad
Thank you Raj V, what makes me think it should work is that the error message DOES  display correctly for Trigger.new context...so I'm trying to find out why it doesn't work for Trigger.old
Avishek Nanda 14Avishek Nanda 14

HI Melinda,
Using stadard  page we can have these kind of messages only when we save info  , but we cannot have this for delete actions as the page will be redirected to some predefined page. The only way is to customize the detail page usign visual force and there we can have own custom validation. 

Avishek Nanda