Setting a role centre per client type

I was in a discussion with some fellow MVP’s today and the subject of different role centres for the windows tablet and especially the phone client came up. I contend (with some at Microsoft disagreeing) that often what you want on your phone is not the same as what you want on your full desktop client.  I promised to detail how I’ve managed to customise this in 2016.

So, how do you do this?

1. I choose to add three fields to the User Setup table and page (which means I can change it per company) – those fields had a table relation across to the Profile ID field in the profile table.


2. Create a codeunit with a function that when called returns the profile ID of the role centre you want to use using the new 2016 CurrentClientType function.


3. Next on the properties of that function make it an event subscriber to the OnAfterGetDefaultRoleCentre event function in the codeunit one event publisher


4. Next make sure you take the Profile ID is blank on the Users Personalization page.


5. Finally make sure there is none of the records listed on the Profiles page have the ‘Default Role Centre’ flag set.


Now when you login, the system cannot find a profile to use from your user or a default on the profiles table, so it triggers the DefaultRoleCentre function in codeunit one. This will set the profile ID to the default 9006 (yes, its hard coded!) via a call to codeunit 9170. Then however it calls the event we have just subscribed to, it works out which client your using and changes the profile ID in time to set everything up as need.

Simple but effective if you agree we need a profile that’s at least different for the phone.