Hi, Readers.
Today I would like to share another mini tip about Business Central, how to get current Profile (Role) info (Profile ID, Display Name, Source, Role Center ID, etc.).
We’ve briefly discussed how to get current profile ID (Role) via AL before. However, the following method can only get the profile ID, and cannot get other information about this profile, such as Display Name, Source, Role Center ID, etc..

Profile (Role):

This time we can use codeunit 9170 “Conf./Personalization Mgt.”.

procedure GetCurrentProfile(var AllProfile: Record “All Profile”):

Let’s look at a very simple example.


Great.

Test video:
Very simple, give it a try!!!😁
Test code:
pageextension 50119 CustomerListExt extends "Customer List"
{
trigger OnOpenPage()
var
ConfPersonalizationMgt: Codeunit "Conf./Personalization Mgt.";
AllProfile: Record "All Profile";
Msg: Label 'Current Profile: %1\Role Center ID:%2\Description:%3';
begin
ConfPersonalizationMgt.GetCurrentProfile(AllProfile);
Message(Msg, AllProfile."Profile ID", AllProfile."Role Center ID", AllProfile.Description);
end;
}END
Hope this will help.
Thanks for reading.
ZHU




コメント