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 :
Microsoft Dynamics AX (Archived)

Regards to How I can hide a particular Module in Dynamics 365 for operations

(0) ShareShare
ReportReport
Posted on by 220

Hello,

I have a need to hide a particular module say, Production Control from the navigation Bar. Can anyone help me on this please?

*This post is locked for comments

I have the same question (0)
  • Mea_ Profile Picture
    60,284 on at

    Hi Sherwin,

    To hide a module you need to restrict user's security, so he won't have access to any menu item under this module.  Please note that same menu item \ form could be in several modules, for example, sales orders could be opened from AR and Sales and Marketing modules, so user with access to sales orders could see 2 modules.

  • Suggested answer
    Pravasti AK Profile Picture
    2,985 on at

    Hi Sherwin,

    Here there is a possibility that in two different modules named X and Y there are some common Menu items.

    In our case we want to make sure that only the Module that we want to appear comes up, and the other Module

    is not visible even if it has some Menu Items that are common with the visible Module.

    As we know there is already an option to customize the navigation pane (which shows or hides modules).

    So the code below will achieve this functionality :

    *//Code for Hide Modules Functionality

    public static void HideModulesForRole()

    {

       container   cont_navButtons;

       container   cont_UserRoles;

       TreeNode            menunode;

       TreeNode            mainmenunode;

       TreeNodeIterator    menuitemiter;

       str aotName;

       int i = 1;

       int j = 1;

       int loc;

       boolean isAdmin = false;

       SecurityRole        securityRole;

       SecurityUserRole    securityUserRole;

       #AOT

       #define.Zero('0')

       #define.MainMenuLocation('\\Menus\\MainMenu')

       //Fetch all roles for currently logged in User and insert in variable cont_UserRoles.

       while select securityUserRole

           join securityRole

               where securityUserRole.User == curUserId()

                   && securityRole.RecId == securityUserRole.SecurityRole

       {

           cont_UserRoles += securityRole.AotName;

           if (securityRole.AotName == '-SysAdmin-')

           {

               isAdmin = true;

           }

       }

       if (!isAdmin && conFind(cont_UserRoles, 'YourRoleName'))

       {

           mainmenunode = TreeNode::findNode(#MainMenuLocation);

           menuitemiter = mainmenunode.AOTiterator();

           menunode     = menuitemiter.next();

           while(menunode != null)

           {

               aotName = menunode.AOTname();

               if(aotName == 'Home' || aotName == 'YourMenuName')

               {

                   // Prefix 1 to show module

                   cont_navButtons = conIns(cont_navButtons, j, '1' + aotName);

               }

               else

               {

                   // Prefix 0 to hide module

                   cont_navButtons = conIns(cont_navButtons, j, '0' + aotName);

               }

               j++;

               menunode = menuitemiter.next();

           }

           // Hide Modules with 0 as prefix

           infolog.navPane().setCurrMenuButtons(cont_navButtons);

       }

    }

    So this static method needs to be called from the startupPost method of the Info class.

  • Mea_ Profile Picture
    60,284 on at

    Hi Kavitha Rajan,

    Tags of this question says current version of AX ( Dynamics 365 for Operations). Did you test this code with D365O ?

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

    Hi Sherwin,

    To hide the features you can also disable the related configuration keys. I haven't use this myself in Dynamics 365, so test it in a separate environment first.

  • Sherwin Profile Picture
    220 on at

    Hi Ievgen,
    Thank you for the reply. So if I want to completely hide Production Control for a particular user. How can I do that? Can you give me the steps please?

  • Mea_ Profile Picture
    60,284 on at

    Hi Sherwin,

    Instead of hiding  Production Control you probably want to create new role that has access only to specific functionality. I don't think that you want to give full access to everything in AX except production control, do you ?

  • Sherwin Profile Picture
    220 on at

    Hello

    I need to hide almost 4 modules for a particular user. Is it possible?  And if so please help me with steps.

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

    Hi Sherwin,

    The topic of your question is changing... Not only hiding Production Control, but almost 4 modules. Can you explain "almost 4"? Are you trying to change an existing role or a role which was new created by a customization?

    You can start creating a role with the required permissions like Ievgen also mentioned if you try to remove functionality from a standard role. Otherwise remove duties/privileges which are related to the functionality that needs to be removed.

    You can view related security objects per menu item. Also the Security Development Tool can help providing insights what duties/privileges are related.

  • Suggested answer
    Pravasti AK Profile Picture
    2,985 on at

    Hi Sherwin,

    The easy way to do this is navigate to File on the user's UI, then select View > Modules. At this point, you can select/deselect modules that this employee will see.

  • Guruprasanna Profile Picture
    1,078 on at

    Hi Experts,

    I need to hide the module based on the parameter set in the system administration module in D365. I have refereed the article in the below blog. 

    https://axapta-rblearnt.blogspot.in/2016/06/ax-2012-how-to-hide-modules-as-per-user.html

    And when it run in the below line of code. 

    infolog.navPane().setCurrMenuButtons(containerwithModuleNeedToHidewithZeroPrefix);

    Error is thrown.

    Microsoft.Dynamics.Ax.Xpp.InfoException at Microsoft.Dynamics.Ax.MSIL.Interop.throwException(Int32 ExceptionValue, interpret* ip) at Microsoft.Dynamics.Ax.MSIL.cqlClassIL.Call(IntPtr c, String methodName, Object[] parameters, Type[] types, Object[] varargs, Type[] varargsTypes) at Microsoft.Dynamics.Ax.Xpp.XppObjectBase.Call(String methodName, Object[] parameters, Type[] types, Object[] varargs) at Dynamics.AX.Application.xInfo.navPane

    Can anyone tell how can i hide module in D365 using code or any alternative ? 

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans