Our support engineers have assembled the top recommended solutions for you.
Microsoft Dynamics AX 2012
Upgrading to Microsoft Dynamics AX 2012
Data Import, Export, and Migration
Microsoft Dynamics AX 2009
Application Object Server (AOS)
Enterprise Portal and Role Centers
SSRS and SSAS Integration
I have started working on data security policy in AX2012.
The requirement I have is to add the range value of XDS query dynamically.
The requirement is when user logs into AX I need to pickup the position the user is assigned to and show the workers only assigned to the position on workers form.
Hence for the XDS query I need to pass the value dynamically on the runtime.
I have tried writing the code in the init and run method of the query to default the range value, but doesn't seems to be working.
My question is does AX execute the code written in the AOT queries or the range value has to be hardcoded which means static.
Please share your thoughts.
Unluckely we had this same problem at a customer today. Last week we had no problems. A new kernel update was installed and caused the behaviour as you described above.
So today I had a look and found out that indeed the table used for query the data was a constrainted table as well. Note that the software was not updated, only the kernel.
In the AOT I created a view based on the table. Changed the XDS method and it works again.
Have you managed to get it work for your scenario?
André Arnaud de Calavon
It is possible to create a temporary table (type TempDB) and use this table within the query for your security policy. On the temporary tabel you can add a method called 'XDS' to dynamically fill this table. Depending on a call (RefreshFrequency) you can cache this table per usersession.
Take a look at the table "MyLegalEntitiesForXDS" for an example of this method.
I have tried the solution suggested by you, but it doesn't seems to be working in my scenario.
The requirement I have is to get the workerId from logged in userid and then get the primary position of the worker so that I can get all the position reporting to logged in user position.
Once I know the positions then I need to get the workers assigned to these positions.
To get the WokerId i am using static method on table HCMWorker.. But since HCMWorker is part of the XDS policy as a constraint table this static method returned 0 as the recid.
I believe since HCMWorker table is part of XDS policy, I can not use X++ select statement on the tables that are part of XDS polciy.
Could you please suggest your thoughts on the Issue i am facing.
Or if there is any other solution you would recommend me on this.
The only way I found to disable the xds at run time is to set the property ContextType of security policy to ContextString and then at runtime use xdsServices.setXDSContext(0, ''); to disable it. The downside is that the policy has to be applied manually on the objects unlike role based context where the policy is applied automatically.
There is another 'dirty' solution to the problem. You can query the database directly by using Connection class. Not recommended but it works as well.
You can use a 'view' containing the HCM worker table. Then the policy is not applied to the HCM worker table as the view is a different one for XSD policies.
I don't know if you still need a solution, but you can create a static method in the SysQueryRangeUtil class and use the return value for the range in your query.
In the AOT, the range value property would be:
There's an example in this whitepaper: www.microsoft.com/.../details.aspx
Hope that helps you.
Sorry for replying very late on this.
Yes based on your suggestion I did the same by creating views for the tables that were involved in security policy. Then changed the XDS method it started working.
Thanks a lot for your suggestion.
Learnt some thing new.
Thanks for the reply.
Yes I was able to achieve through the solution suggested by Andre above.
Thanks for the suggestion I believe this would be another way to achieve it and go to know that you can secure the data based on financial dimension too.
Other Microsoft Sites
I'm a Customer
I'm a Partner
Follow Microsoft Dynamics