Question

I am getting the following Best Practice error in Dynamics AX 2009 for any menu item assigned my primary security key (we'll call it MySecurityKey1).

"Wrong security key. Security key must match position in main menu."

I have the following items in my project:

Menus
    MainMenu (Dynamics default item - security key is blank)
      - Reference to MyMenu
    MyMenu (Key = MySecurityKey1)
      - MySubMenu1 (Key = MySecurityKey1)
          - Reference to MyMenuItem1
          - Reference to MyMenuItem2
      - MySubMenu2 (Key = MySecurityKey2)
          - Reference to MyMenuItem3
          - Reference to MyMenuItem4

MenuItems
    MyMenuItem1 (Key = MySecurityKey1) !!BP Error on this item
    MyMenuItem2 (Key = MySecurityKey1) !!BP Error on this item
    MyMenuItem3 (Key = MySecurityKey2)
    MyMenuItem4 (Key = MySecurityKey2)

Security Keys
    MySecurityKey1 (No parent key)
    MySecurityKey2 (No parent key)

I'm pretty much at a loss, because there doesn't seem to be any real difference between the two keys or their use. Any suggestions would be great.

Thanks!

Was it helpful?

Solution

This BP check is implemented in SysBPCheckMenuFunction.checkSecurityKey(). It looks like if your menu is accessible from the main menu, then you must have a parent security, lets call it MyModule, and child security keys. The only valid child security keys would be MyModuleDaily, MyModuleReports, MyModuleInquiries, MyModulePeriodic, MyModuleSetup, MyModuleJournals, MyModuleMisc, or MyModuleTables.

OTHER TIPS

Is the BP error on MyMenuItem1/2 or MyMenuItem3/4? I would expect one if it was on MyMenuItem3/4, since I believe all items in a menu need to share the same parent security key.

Have you tried introducing a third security key that would be used by MyMenu and would be a parent for both MySecurityKey1 and MySecurityKey2? I think doing this is the correct approach and is inline with how most of the menus referenced by MainMenu are setup.

For example, the Ledger security key has the children LedgerJournals, LedgerInquiries, LedgerReports, etc. Then under the Ledger menu there are submenus for Journals, Inquiries, Reports, etc and each of the menu items in the submenus uses the related security key.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top