This is a very quick post to answer a question sent to me privately today by a Dynamics 365 Business Central partner. Question was the following: Why a permission set can have only 20 characters in the name? Is it standard or is it an AL extension bug?
AL permission sets name length check has a sneaky behaviour in Visual Studio Code. Let’s create a simple permission set like the following:
This permission set is defined with a long name and the AL compiler gives you the following error:
The length of the application object identifier 'SD Base permission with long name' cannot exceed 20 characters.
Ok, permission sets names must have 20 characters…
But the previously defined permission set has the Assignable property setted to true. This means that it can e assigned to users via UI. What happens if we remove this property?
The length of the application object identifier 'SD Base permission with long name' cannot exceed 30 characters.
Oh… the name now can have 30 characters??? Is this a bug or what?
This is not a bug but it’s a “not nice” standard behaviour of the AL extension. Some Business Central releases ago (I don’t remember exactly how many) Microsoft tried to change all the permissions sets names to 30 characters. But unfortunately this was a breaking change on some cases and the limit was backported to 20 again.
So, current “state of the art” of the permission sets names rules is the following:
- If the permission set is assignable (Assignable = true property) then names must be 20 characters at max
- If the permission set is not assignable, then names can have 30 characters at max
If you want to be safe on every case, then you should have permission sets with 20 characters at max in the name, at least for now…