Skip to main content

Security Policy with Financial Dimensions

I used to have customers that would like to limit the data available in whatever department or group they belong to.

So for this entry, I will discuss the security using organization hierarchy. Actually there are white papers available that discusses the following:

For this post though, I will be deviating a little bit from what has been discussed in the white paper.

So you must already know that you can setup what Legal Entities and Operating Units are available for a specific user and role. If not, you can actually do that from System administrator à Common à User à User’s role à Assign organization button.


Know that the organization hierarchy to be used here should have a hierarchy purpose Security.

It’s great that we have an available setup for this, unfortunately this is only limited to Legal Entities, Global Address Book, Budgets, HCM Records, Retail, etc. For the complete list, just check the Security Policies node from the AOT.

For this entry, what I would like to achieve is the limitation of records based on Default Dimension. I will be using the Release Products list as a sample. The Released Products has a parent table called InventTable which contains the field DefaultDimension. We will be filtering the Default Dimension based on the set Operating Unit from the Organization users setup.

Before creating a Security Policy, you will need to have:
  • The list of operating units available for the user
  • Query to limit the Default Dimension in InventTable

List of Operating Units available for the user

If you will navigate to OMUserRoleOrganization table, you will be able to see the complete list of assigned InternalOrganization record for every user. However, the record here is in reference record id form and it is not yet filtered to the current user’s session.

If you will look for the tables with My* prefixes, you will only see MyDepartments, MyDirectReports, MyLegalEntities, MyPartyUsers and MyRoles. These tables are temptable with XDS method that gets populated according to its RefreshFrequency. We don’t have a My* table that contains the complete list of Operating Units from our Internal Organization, so here’s a sample table that I have created:

It contains the Operating Unit Number, Reference Record Id, and Operating Unit. We will populate this every time a session is created for the current user, this can be done through XDS method:

Query to limit the Default Dimension in InventTable

So now that we already have a list that contains the assigned operating units, let’s attach this to DefaultDimension. You may use the view DimensionAttributeValueSetItemView. Just in case you are working on LedgerDimension, you should use the view DimensionAttributeLevelValueView. So here, I created a very simple query named DefaultDimensionByDept that contains the view and MyInternalOrgForXDS.  I used exist join here to make sure that only default dimensions existing in the setup is accessible. I won’t be including the InventTable here, but technically do that.

Why By Department? Basically you will need to create 1 query for every Operating Unit Type or Custom Dimension – because if we will not put a range here for DimensionAttribute, the behavior will be as if we are using OR filter on dimensions. For example:
Granted Access
Business Unit: 06
Department: 031, 025, 028

Item
Business Unit
Department
Expectation
If query doesn’t have Dimension Attribute filter
Item A
06
031
Accessible
Accessible
Item B

025
Not accessible
Accessible
Item C
06

Not accessible
Accessible

Well, unless you prefer this behavior, you’re free to do it as you please.

Just in case you’re wondering what’s the value of the range for DimensionAttribute, here it is – created from SysQueryRangeUtil:

Creation of Security Policy

The query that we have created above will be used in our security policy. You may create the security policy from the AOT à Security à Policy. Here we have used the DimensionAttributeValueSetItemView as the primary table. Know that whenever you are creating a policy, the primary table that you will set here should be available from your query as well.

As you noticed, I also set here the context type RoleName for role SystemUser. Technically all users of AX has the role SystemUser that’s why I used it here. I don’t think it will work though with SystemAdmin. Now, let’s attach the InventTable under Constrained tables. I used Add table or view by free form expression and set the relation to: DimensionAttributeValueSetItemView.DimensionAttributeValueSet = InventTable.DefaultDimension.

You must be wondering why I attach it this way when in fact I can just attach it directly to the query. Let’s just say that this is one way of doing it, plus I can just create 1 policy and list down all the other tables with DefaultDimension like PurchTable, SalesTable, CustTable, etc. I just find it tedious to create so many queries for every tables with Default Dimension field.

I guess it’s for you to decide how you want to do your own policy. I would just like to emphasize that this code is just in draft mode, and I did not thoroughly test it so it can still be improved a lot.

Hope this helps!

KR, Lyka


Comments

Post a Comment

Popular posts from this blog

Opening RPF Files

In Dynamics AX 2012, we have this concept of pushing and pulling the data for Retail between Head Office and Store. The data is written in XML form, compressed into an rpf file then saved to a working folder.  These rpf files or data packages can be opened using DDPackView.exe which is available if you install Async Server (Head Office) or Async Client (Store). You may find it in: C:\Program Files (x86)\Microsoft Dynamics AX\60\CDX\Async Server\Package If you execute it from here, you will need to specify the actual rpf file you want to check and click Convert . You might encounter an error: Could not load file or assembly 'Microsoft.Dynamics.Retail.StoreConnect.RequestHandlerManager, Version=6.3.0.0, Cuture=neutral, PublicKeyToken=xxxx or one of its dependencies. The system cannot find the file specified. Usually, I just copy the following in the same folder of DDPackView: DDPackView.exe.config Microsoft.Dynamics.Retail.EventTraceProvider.dll Microsoft

Importing Retail Transactions from POS to AX

Hi, regarding the synchronization of retail transaction from stores to HO, I received some inquiries what are the alternatives when there is an issue in the store that will prohibit Async Client from sending data to HO – for example, network issues, hardware failures. Well, there is always the ever helpful DMF entities . It is limited – however, the 3 main tables needed to successfully Calculate Statements every end of day are all provided as standard entities. If you are using the demo data from Contoso, chances are you will not be able to see these entities. However, go to Data import export framework à Setup à Target entities , just click New and drop down to Entity field and select as what has been provided above. This should automatically populate the columns Staging table , Entity Class and Target . Note : If you have a legacy POS with transactions which you want to integrate with AX, you can just use this and just make sure that it will follow th

Synchronizing Retail Transactions from Store to Dynamics AX

Hi, In my previous post, I have discussed about the details of downloading data from Head Office to Retail Store. Today, let’s discuss the process of synchronizing transactions from Retail Stores to Head Office. In a hindsight, the Async Client service in store is responsible in creating the RPF files and saving it in the Upload File Path Working folder . The RPF files of the retail transactions are created every interval as specified in the Async Client Configuration . Running the P-Job is unnecessary to create the RPF files, what we need is a secure connection between Async Client and Async Server every upload interval. Basically, the P-Job is for importing the transactions from the Upload Working Folder to Dynamics AX. So how does the Async Client know which record to include in every creation of RPF files? In AX 2012 R3, the Channel Database is maintaining the table called crt.TABLEREPLICATIONLOG . This table contains the following field: FIEL