Hi,
after a long time, it’s time for some blog post 🙂
These days I am struggling with the creation of user-defined permission sets in Dynamics 365 Business Central v16. A user-Defined permission set is one that is not available out of the box, and it is not part of any extension, so basically, you created this permission set manually in Dynamics 365 Business Central. In the picture below, you can find my User-Defined permission sets, which I am creating for the Finance administrator.
Now, if you want to grant/remove permissions from permission sets, you can click Permission action at the ribbon.
In Permissions screen you can enter manually one by one object, you can use an awesome tool called Permission Recorder, or you can try as I did, and use Configuration Package
And, I happily created the configuration package for Permission and Permission set tables. When I exported my permissions to the Excel, I got all permissions EXCEPT my FINADMIN Permission.
After that, I started to investigate where the is problem with my permission? I found that if you want to use a configuration package to migrate your permissions and permission sets, you will not be able because the configuration package will export all permission sets except one of type User-Defined and Extension.
So now, I am stuck with manually entering each object into a permission set or using a permission recorder, or you can export your permission set to the XML.
Then you will get something like this where you can see the connection between permissions and XML.
Okay, now I have something which I can modify and import because I have Import Permission Sets action, which will import my XML.
But now what I want to do is somehow translate my Excel file where I have all previously defined permission to the XML, which I can import into Dynamics 365 Business Central. Here bellow is one part of my Excel file where I have Object type, object id, object name, and permission for the object type and object id.
Now, how to transfer this to the XML file which I can use to import my permission set is really simple. You need to click Developer ribbon and then Source and in XML Source click XML Maps…
In the XML Maps window click Add… and import your XML which contains permission set from the Dynamics 365 Business Central.
If you get the pop-up that XML source does not refer to a schema, just click OK, and then again on OK in XML Maps window. Now in XML Source side pane, you will get XML schema from the permission set.
Now what we just need to do is Drag/Drop fields from an XML schema to our Excel table. Just drag ObjectType field to the A1: ObjectType, ObjectID to the B1: ObjectID, ExecutePermission to the C1: ExecutePermission
You will get the Excel table formatted in this way, and all that you need to do is on Developer ribbon click Export and save XML to your PC.
You will get the XML like one on the picture below, and now you can select all inside PermissionSet tag and copy to your original XML.
And then you will get completed permission set which will look something like this
You can now save this XML file and go to Dynamics 365 Business Central and import this XML file.
You can confirm that you want to update permission set, and then choose your XML file, and finally, your permissions will be appended to your Permission Set.
Notes for the end
if you don’t see Developer ribbon you need to enable it in Excel options.
This way will also work with different permissions inside one permission set.
In the Excel sheet table, you must have only columns that you will use for the XML. For example, in the XML file, there is no Object Name field, so this cannot be part of your Excel sheet table, so before everything, prepare your Excel table to have only Object Type, Object ID, and permissions.
Br,
Renato 🙂