Block Deletion of Record from any table

Vineeth.RVineeth.R Member Posts: 121
Hi Friends,

I want to block everyone from deleting records from one table. I should not be able to delete records even from a report(indirectly). Is there such a control i can define in navision table property or SQL for that table?

I know i can control thru roles and permission. any other way?
Thanks and Regards
Vineeth.R

Comments

  • imclever1205imclever1205 Member Posts: 94
    Go the Table Properties --> Permissions and then you can apply the permissions you want ....
  • Vineeth.RVineeth.R Member Posts: 121
    Hi clever,

    Table properties do not help.

    I want no one to delete any records from Product Group (5723) table. Accidentally data is getting deleted from here. We do not know which program is deleting it.

    Without controlling the roles and permission of users is there a way to stop this?

    thanks
    Vineeth
    Thanks and Regards
    Vineeth.R
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    If there really is no other way you might consider SQL triggers.
  • krikikriki Member, Moderator Posts: 9,112
    If you are using NAV2009R2 or NAV2013, you can use OnDatabaseDelete-function in codeunit 1. Test if the recordreference is your table and if it is raise an ERROR.
    This function is triggered also if the DELETE is done by C/AL code instead of the user.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Vineeth.RVineeth.R Member Posts: 121
    Hi Kriki,

    i tried the below code in codeunit 1 but it did not work. Can you please explain how to use the code

    OnDatabaseDelete(RecRef : RecordRef)

    ChangeLogMgt.LogDeletion(RecRef);
    IntegrationManagement.OnDatabaseDelete(RecRef);
    IF RecRef.NUMBER = 5723 THEN
    ERROR('cannot delete');
    Thanks and Regards
    Vineeth.R
  • vaprogvaprog Member Posts: 1,141
    Did you arm it in GetDatabaseTableTriggerSetup and restart the client before testing?
  • krikikriki Member, Moderator Posts: 9,112
    vaprog wrote:
    Did you arm it in GetDatabaseTableTriggerSetup and restart the client before testing?
    Correct!
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.