Anti-Delete Code

Noelit
Noelit Member Posts: 23
](*,) ](*,) ](*,) ](*,) ](*,) How do i add code to prevent a user from deleting data in a list i.e to prevent someone 4rom deleting a Hotel Floor before all the rooms are determined to be empty.

Comments

  • kine
    kine Member Posts: 12,562
    Add the check into OnDelete trigger of your table...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • arindom
    arindom Member Posts: 52
    Write code ONDELET of the table to validate .
  • DenSter
    DenSter Member Posts: 8,307
    Set the 'DeleteAllowed' property to No, make the form not editable, develop functionality to only allow certain people access.

    Wait.... what about setting up the proper permissions? That way you don't have to program anything.
  • apertierra
    apertierra Member Posts: 61
    DenSter wrote:
    Wait.... what about setting up the proper permissions? That way you don't have to program anything.
    Noelit wrote:
    data in a list i.e to prevent someone 4rom deleting a Hotel Floor before all the rooms are determined to be empty.

    Sure... permissions... and I suppose that they will change permissionsn after manually checking if all the rooms are empty.....
    Noelit: You will need modifying the ondelete trigger and, in there, do the calculations required to check if they are allowed to delete the record, and, if not, give an error.