Assigning menu suites based on company
Unfortunately, NAV only supports assigning one menu suite to a user. This recipe will show you how to set a user's menu suite at runtime based on the current company.
How to do it...
Design the User Menu Level table (2000000061).
Save the table as User Menu Level by Company with a new object ID.
Add the following field to the table:
Name
Type
Length
Company
Text
30
Set the following properties for the field:
Field Name
Property Name
Value
Company
TableRelation
Company
Company
NotBlank
Yes
Add the Company field as the first field under Primary Key.
Save and close the table.
Create a new codeunit from Object Designer.
Add a global function named
LoadMenusuite
.Add the following local variables to the function:
Name
Type
Subtype
UserMenuLevelComp
Record
User Menu Level by Company
UserMenuLevel
Record
User Menu Level
Session
Record
Session
Add the following code to the function:
Session.SETRANGE("My Session", TRUE); IF NOT Session...