Skip to main content

Notifications

Dynamics 365 Community / Blogs / fajdiga.info / How to work with user-defin...

How to work with user-defined permission sets

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.

null

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

null

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.

null

Then you will get something like this where you can see the connection between permissions and XML.

null

Okay, now I have something which I can modify and import because I have Import Permission Sets action, which will import my XML.

null

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.

null

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…

null

In the XML Maps window click Add… and import your XML which contains permission set from the Dynamics 365 Business Central.

null

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.

null

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 D1: ExecutePermission

null

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.

null

You will get the XML like one on the picture below, and now you can select all inside … and copy to your original XML.

null

And then you will get completed permission set which will look something like this

null

You can now save this XML file and go to Dynamics 365 Business Central and import this XML file.

null

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.

null

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

The post How to work with user-defined permission sets appeared first on fajdiga.info.


This was originally posted here.

Comments

*This post is locked for comments