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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

hide/show buttons for a specific role depending on specific criteria

(0) ShareShare
ReportReport
Posted on by 15

Hi everyone

i m trying to grey out " release to warehouse" button depending on a specific value of column in sales table and all this for a specific role

i m working in pharmaceutical industry and we have added a column in sales tables to define if the sale order contains psychoactive drug or not so if it is, the " release to warehouse" sould be greyed out

please can you help me

Peace

I have the same question (0)
  • Suggested answer
    Sergei Minozhenko Profile Picture
    23,093 on at

    Hi Pharma,

    Usually, you need to make the next steps:

    1. Change "AutoDeclaration for the button to "Yes" on a form to be able to access the button from the code.

    2. On active method for data source after "super" you call enable method on button variable with true or false (button.enabled(false))

    3. if you want to implement this change only for a specific role you have several options

    3.1. Make a copy of button with new privilege and give access to the specific role and remove access to the old button

    3.2. Add parameter with the role selection and implement the function to check if the user has a role from parameters - similar to blog.andrewhuey.com/.../

  • André Arnaud de Calavon Profile Picture
    301,020 Super User 2025 Season 2 on at

    Hi Pharma,

    In addition to the reply from Sergei... It might be the case that there is existing logic in the application which controls the behavior of this button. In that case, you have to extend this logic with your requirements.

  • Pharma Profile Picture
    15 on at

    hi Sergei

    thank you for your response

    so i am a beginner and i want to know more about the solution you ve proposed

    i m stucked on step 2

    where can i find this 'active method"

    thank you

  • André Arnaud de Calavon Profile Picture
    301,020 Super User 2025 Season 2 on at

    Hi Pharma,

    If you can't find the active method on a datasource, you can right click the method node and choose to create a new override method for active().

  • Sergei Minozhenko Profile Picture
    23,093 on at

    Hi Pharma,

    Here is also documentation about avialable methods on form data sources.

    docs.microsoft.com/.../methods-on-a-form-data-source

  • Pharma Profile Picture
    15 on at

    hi

    thank you so much

    but i have one more question , i want to use your function " IsUserInRole "

    my question is how to get the AOT rolename of a role for example "SalesManager" role

    thank you by advance

  • Pharma Profile Picture
    15 on at

    hi

    which ax function could give me the aotname of a role

    for example i want to use your function IsUserInRole

    how can i get the argument rolename for a "SalesManger" Role for example

    hope i ve been explicit

    thank you

  • André Arnaud de Calavon Profile Picture
    301,020 Super User 2025 Season 2 on at

    Hi Pharma,

    At least the system table SecurityRole contains the information you are looking for.

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 646 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 529 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans