SQL Server Is there a way I can generate a list of all entities in CRM and if they have audit history turned on or not?

jtw3ybtb  于 2023-04-04  发布在  其他
关注(0)|答案(4)|浏览(106)

I checked an entity in the CRM SQL database but there wasn't a column specifying about audit history. I know there is a way to enable / disable it through CRM's online portal but that would take a pretty long time to see which entities have it enabled and which have it disabled.

I've tried poking around but couldn't find much on the topic so I figured I'd see if anyone here knew anything about it or had any experience with it.

Here is a quote from Microsoft's page on accessing it through the online portal:
Click the entity for which you want to start or stop auditing. To start auditing, on the General tab, in the Data Services section, select the Auditing check box. To stop auditing, clear the check box.

http://crmbook.powerobjects.com/basics/data-management-in-microsoft-dynamics-crm/auditing-in-microsoft-dynamics-crm/

Let me know if there is anything I can add to make my question more clear.

jfgube3f

jfgube3f1#

Referring you once again to the XrmToolbox.... The MetaData Browser does what you're looking for:

Please note that for this screenshot I used the Columns button to move the IsAuditEnabled column as far to the left as possible.

And since you indicated that you have access to SQL, here's a query:

SELECT EntityId, Name, IsAudited
FROM MyOrg_MSCRM.MetadataSchema.Entity

If you're looking to do this in C#, the RetrieveAllEntitiesRequest class is a good starting point.

t9aqgxwy

t9aqgxwy2#

Download XrmToolBox & enable/disable audit in single stretch.

Audit center plugin will help you to complete the magic.

Read more

Update: After you install the xrmtoolbox, Connect to Org, Click 'Audit center', Click 'Load data' - Audited entities & attributes will be listed:

cl25kdpy

cl25kdpy3#

Use XRMToolbox tool called SQL 4 CDS and use the below query to get all the entities and attributes where Audit is enabled. You can copy the data to excelsheet and off you go. Good Luck.

SELECT attribute.displayname AS "Attribute Display Name",
       attribute.logicalname AS "Attribute Logical Name",
       entity.displayname AS 'Entity Display Name',
       attribute.entitylogicalname AS "Entity Logical Name"
FROM   attribute
       INNER JOIN
       entity
       ON attribute.entitylogicalname = entity.logicalname
WHERE  attribute.isauditenabled = 1
and entity.isauditenabled =1;
r55awzrz

r55awzrz4#

SELECT  E.displayname, E.logicalname FROM metadata.entity E
WHERE E.isauditenabled = 1

相关问题