How to disable a button of a form using security roles


I am working on security roles.I need to disable some buttons in a form.I have a form A .In that form I have a menuitem button which opens form B.But the system uses some code in clicked method of menu item in form A’s design to open form B.I need to disable the buttons in form B using security roles.How can I acheive this.Is there any way to do it using Security in AX.Any help would be appreciated.

If in Form B , you have a simple button, you can hide that specific button by overriding permission for a specific role.

For that go to → System Administration → Setup → Security → Security Roles.

Select any specific role and click on Override permissions button under Action Pane.You can see the Controls option in left side of the form which contains the list of available forms. Expanding that form you can find your button and you can et the excess level from the right side.