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

form control need to disabled based on role in AX 2012 R3

(0) ShareShare
ReportReport
Posted on by 30

hi All,

I have create a new role like "Product receipt".

My requirement is ,

Suppose , If I assign this role to specific user, the particular user when open the Posting Product Receipt form below marked option should be disabled.

*** This should be applicable for only one entity.

AP - Receive - Product Receipt - Posting Product Receipt

Kindly let me know how will achieve this?

Please give me more shed on this.

thanks!

I have the same question (0)
  • Suggested answer
    André Arnaud de Calavon Profile Picture
    301,075 Super User 2025 Season 2 on at

    Hi @rp@n,

    There is no deny permission in AX 2012. You can't achieve it with security configuration only. If you want to do it with help of security settings, then you need to change the form controls and set the property NeededPermission to manual. Then on the roles which would need access, you have to add specific permissions to these controls.

    It would be probably easier to do all with custom coding on this form. Check the company and role and depending on the outcome disable the buttons and make the controls non-editable.

  • Suggested answer
    ergun sahin Profile Picture
    8,826 Moderator on at

    I agree with Andre. It's much simpler to manage with code. You can check if the user has the relevant role by modifying the code I shared below.

    The thing is, there should be a method in the global or in one of the frequently used classes, but if you use securityRole.AOTName (not sure about full Name),  with select firtOnly, it will work

    community.dynamics.com/.../list-of-security-roles-for-current-user-d365fo

  • @rp@n Profile Picture
    30 on at

    Hi Andre,

    Thanks for prompt response.

    Sorry not understand.  Kindly elaborate me please.

    Thanks!

  • Krishna Pushpak Profile Picture
    265 on at

    Standard Security framework within AX ,cannot provide legal entity specific restrictions .need to write the code to get desired solution

  • @rp@n Profile Picture
    30 on at

    Hi Krishna,

    thanks!

    do you have any code sample? 

  • Suggested answer
    ergun sahin Profile Picture
    8,826 Moderator on at

    Exactly what kind of sample do you want? Actually, you have everything you need right now.

    You can use the above code to check if the user is included in that role.

    You can check which company you are in with "curExt()".

    You can use "args.caller" if you are going to add a special control about the form you came from

    Lastly, You can write this process in the init of the form.

    The rest is to combine this information and decide to disable/enable the control.

  • @rp@n Profile Picture
    30 on at

    thanks Ergun,

    In the above code , I have to hardcoded the role right? then only we can validate the role is having the user or not .

    am i right?

  • Suggested answer
    ergun sahin Profile Picture
    8,826 Moderator on at

    You can open a field in the parameter table and keep it there, or you can use a Macro as in the example below.
    However,in these solutions too, if the name of the relevant role in AOT is changed, it will fail. Basically, there is no serious difference from writing hardcode.

    #SysSecRole
    
    // Production Manager = 'ProdProductionManager'
    select firstonly AotName, RecId from securityRole where securityRole.AotName == #RoleProdProductionManager;

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 503 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 278 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans