Tuesday, April 2, 2013

Tip - How to retrieve Security Policy Metadata info stored in ModelSecPolRuntimeEx (Dynamics AX 2012)

Dear Friends,

Thought to share with you about this table in Dynamics AX 2012 which stores the runtime metadata for all the queries involved in Security Policies. I figured out  it's a good starting point for debugging your Security Policies.

The resultset retrieved from the below query will tell you about the PrimaryTable, ConstrainedTable, Query Name, and more importantly, the column ModeledQueryDebugInfo which contains the raw sql statement that is used behind the scenes. (Just copy-paste the below SQL and run in your Management Studio to see the results)

SELECT [PRIMARYTABLEAOTNAME], [QUERYOBJECTAOTNAME],
[CONSTRAINEDTABLE], [MODELEDQUERYDEBUGINFO],
[CONTEXTTYPE],[CONTEXTSTRING],
[ISENABLED], [ISMODELED]
FROM [dbo].[ModelSecPolRuntimeEx]

As per msdn, The ModelSecPolRuntimeEx table stores the runtime metadata that is necessary to apply security policies.



No comments:

Post a Comment