2

I'm trying to avoid record deletion based on record and/or parent status. I've tried two options:

1. Trigger validation on before delete with a record and add Error message if it can't be deleted. Although it's quite ok, the page that it showed is not available in partner portal, it returns the exception page (which it's not ok)

2. So to avoid this I created a visualforce page to override the delete action for that object. It works fine for the delete button on detail page but does not override the delete action for a related list.

Now, I'm asking if anyone has any suggestions. Thanks! Pedro.

2
  • Hi Pedro, where do you have the validation when you use the VF page?
    – Carolina
    Commented Jan 24, 2014 at 11:08
  • Hi Carolina. I have it on the function related to the "action" attribute for the VF page Commented Jan 24, 2014 at 12:35

1 Answer 1

1

I'm going to try to help :) Then I think that the issue that you have could be that the validation is in only related to the VF page. Then any other "deletes" are not going to have the same validation. I would recommend this: 1.-Create all your validations on the low level : triggers ( Also as far as possible try to create the validations on the after trigger) 2.- The VF page will be linked to a controller, and the controller will do the call to "Delete" 3.- The controller would format the error that the trigger will send and the controller will send the formatted error to the VF page to show to the user.

If the users click the other "deletes" the trigger will run always and won't allow them to delete the record.

Hope it helps.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .