Monday, December 8, 2014

Stop deletion of record from a table

Recently came across an issue where records from customized tables were being deleted occasionally. Following wat did a quick fix for me to stop further records delete from table. 

Overwrite delete method on table and comment super(). This also stops deletion from code, e.g. if we write query delete_from table this commented super will prevent user to delete record from table.

public void delete()
{
    //super();
}

This will also stop deletion from code too. e.g.

It worked fine but records can also be deleted by pressing Ctrl+F9 on table browser. To handle this situation I overwrite validateDelete method on table and returned False from there.

public boolean validateDelete()
{
    boolean ret;

    ret = super();

    return false;

}

2 comments:

  1. Hi Faisal,
    Does this apply to table renaming to something different

    ReplyDelete
    Replies
    1. Hi, What actually you want to achieve could you please share in details.

      Delete

I will appreciate your comments !

How to enable new Microsoft teams - Public Preview!

New Microsoft Teams is just AWESOME, quick but useful post below shows how you have this preview feature to make your life EASY!  Open Micr...