Friday, November 23, 2012
There are a few standard solutions for accessing different role functions:
- Other role functions are accessible via Departments menu. But having a dedicated Role Center makes it even easier.
- It is possible to have several shortcuts to NAV where the Role Center name is entered in parameters string. While it is a solution that works, it is done not via NAV and is often not so easy for users who are not advanced.
- It is possible to develop special Role Centers according to specific users' requirements. This is good solution when users mostly do the same actions from several Role Centers.
I would like to tell you about one more intelligent option. With a small modification, it is possible to prompt the NAV application to ask which Role Center (profile) the user wants to use. How does it work?
Codeunit 1 Application Management has a function: DefaultRoleCenter. This function is executable by NAV and has one trick -- when there is default profile (record in Profile table with "Default Role Center" value "Yes") in the system, the function is fired once, but only after the Role Center is opened and it is too late to select the Role Center. If there are no default profiles in the system, the function is called two times -- once before opening Role Center and once after. Knowing this behavior, it is possible to develop own Role Center selection. It is important, however, not to use the standard Profile field "Default Role Center" -- it can be removed from forms and pages. Instead, a new field with the same behavior can be created.
Here is an example how Role Center selection could be done:
1. Design codeunit 1 ApplicationManagement
2. Create global integer variable SelectedRoleCenter
3. Create function SelectRoleCenter with integer return value:
With following local variables in the function:
4. Update standard function DefaultRoleCenter with following code:
5. Test the result. Ensure that there no profiles with checkmark "Default Role Center". Selection will not work for the user with assigned profile - Profile ID should also be blank on User Personalization card.
This is just an example how it could be done. Usually, it is required to limit the number of profiles that can be selected by the user. This means that additional table for storing a user's profiles would be required. Also a proper page should be created for Role Center selection.