This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - Access toolbar to stop create or delete

handpuppet - Tuesday, July 28, 2015 12:59 PM:

I am looking to either disable the add new and delete buttons on the toolbar, or through an event with a method, catch when the user tries to create new or delete and deny them access to do that.  I already have the code to check to see if a user is in a particular identity.  I just need to know how to stop a user from deleting when they click the red X button and stop from creating new



JensRollenmueller - Friday, July 31, 2015 4:02 AM:

Hi,

prevent deletion:

- simply write a Server method and add this as "OnBeforeDelete" on the Item. You can use c# or VB.nat to write the code.

prevent add:

- To prevent add you have 3 different options:

   a) Simply use "Can Add" within the Item to prevent adding of items based on different properties.

   b) Client Method on the Item "OnAdd" - this will prevent adding "before" the form will show up

   c) Server Method on the Item "OnBeforeAdd" - this will prevent adding Item when you try to hit the save button within a form:
       Here you will have the option to validate properties on the form and prevent adding it based on values of properties

Regards,

Jens