cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ballzer0
Advocate I
Advocate I

get version history of entities through api?

Is it possible to lookup the histories of entities or spesific records through the api?
it would be amazing if i could send a request like this. And it would return a snapshot of what the data looked like.

GET: https://myORG.api.crm4.dynamics.com/api/data/v9.1/cr0ad_someEntity?$history='10/7/2019'


And it would return what the data looked like at that time. Or is there maybe a feature that lets me lookup the change history of a specific record? 

Thanks for your time. Its greatly appreciated

1 ACCEPTED SOLUTION

Accepted Solutions
kestenholz
Frequent Visitor

The Audit log is possible to retrieve from CDS e.g. in Power BI. However it will end up in the hundreds of MBs so really not an option. If you are looking for a way to capture historic data to track changes over time, I would suggest to setup a simple "scheduled flow" that copies values from your entity to a shadow entity. Make sure you also drop the UID value of the entity you copy from. This way, you can both see the historic values in a subgrid on the original entity form, or pull it into Power BI for Desktop in a snap.

View solution in original post

7 REPLIES 7
v-siky-msft
Community Support
Community Support

@Ballzer0 

 

Although I don't have experience with APIs, if you want to get the history records, the only way I have found to do this is by turning on the Audit setting for the entity. 

Then maybe you can try to retrieve the Audit Details by RetrieveAuditDetails Function using Web API. Reference: https://docs.microsoft.com/en-us/dynamics365/customer-engagement/web-api/retrieveauditdetails?view=d... 

Hope this helps.

Sik

kestenholz
Frequent Visitor

.

kestenholz
Frequent Visitor

The Audit log is possible to retrieve from CDS e.g. in Power BI. However it will end up in the hundreds of MBs so really not an option. If you are looking for a way to capture historic data to track changes over time, I would suggest to setup a simple "scheduled flow" that copies values from your entity to a shadow entity. Make sure you also drop the UID value of the entity you copy from. This way, you can both see the historic values in a subgrid on the original entity form, or pull it into Power BI for Desktop in a snap.

when you say drop the UID? i assume you mean i should copy the uid into another field called originalid or something like that, that way i can trace back what shadow entities trace back to the original one?

Yes exactly! This way you can easily join the data later on in Power BI.

thanks for the suggestion. im a bit afraid of how fast my dataset is gonna grow, but i think this is the best solution.

How do you retrieve audit from CDS?  I'm unable to see it, and I understood that it was not exposed to PBI or the Data Export Service (Dynamics)?  I had to use an Azure Data Factory pipeline to see it and export it.  Am I missing something?

cheers,

Steve.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Users online (1,424)