web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to hide/show a button on form for a certain role?

(0) ShareShare
ReportReport
Posted on by 334

Hi. Experts:

I know we can use menuitem as the  entry point to setup the privilege.

But how can I do the same thing to a button in the action pane of a form?

I found out there is a neededPermission property for every control on the form.

Can I use this property to make this button only been seen by some roles?

Or there is other ways to do it?

( BTW, I'm using AX 2012 CU7 )

It would be appreciated to anyone can shed some light. thanks!

Quatrani

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Vilmos Kintera Profile Picture
    46,149 on at
    RE: How to hide/show a button on form for a certain role?

    You either use the neededpermission, and the privilege's level of access will drive the visibility of the control:

    msdn.microsoft.com/.../gg881160.aspx

    Or you implement it in the init() method of the form to manually check curUserId() if they have a specific role using the security helper classes, then setting the enabled() property on your button yourself in code, once you have set AutoDeclaration=Yes on the button's properties.

  • JCHI Profile Picture
    334 on at
    RE: How to hide/show a button on form for a certain role?

    Hi, Vilmos:

    thank you very much for the quick reply. I understand what you said about how to use the code.

    however, with neededPermission property. according the link., if I set it to manual and drag it under the read node of form's permission. then set the EffectiveAccess to read.

    If I am in a role with privilege having entrypoint's accessLevel set to READ, then I won't be able to see the button.

    I don't understand what's the occasion to use it, I mean if I set the EffectiveAccess to update , but the button control is still under read node. What is the meaning of it? Can this method can apply to different role?

    Thanks again !

    Quatrani

  • Jacqueline Olson Profile Picture
    635 on at
    RE: How to hide/show a button on form for a certain role?

    Hi Quatrain,

    Perhaps my example here will help - stoneridgesoftware.com/ax-2012-security-role-basics

    I set the Form control (All Cases) to read - so any roles that has Read access to that form can see that button.  I then did an override for that form/form control for the specific role I didn't want to access to that button.

    Hope this helps.

    Regards,

    Jackie Olson

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Community Member Profile Picture

Community Member 4

#2
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

#2
NNaumenko Profile Picture

NNaumenko 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans