Skip to main content

Command Palette

Search for a command to run...

Tracking Data Changes in Power Automate Using Audit Logs

In dynamic business environments, understanding the history of data changes is crucial for auditing, compliance, and troubleshooting. Microsoft Power

Updated
2 min read
A

A seasoned Techno-Functional Professional with 7+ years of experience in Information Technology (IT), specializing in Microsoft Dynamics 365 Customer Engagement (CE) and Power Platform Solutions. I bring extensive expertise in out-of-the-box and custom configurations, customizations, integrations and data migrations. My skill set includes proficiency in working with Model Driven Apps, Canvas Apps, Power Pages (formerly Power Portals), Power Automate, Approval flows, Code Activities, Plugins, Workflows, Business Rules, JavaScript, HTML Web Resources, PCF Controls, Chatbots, SSRS Reports, Microsoft Copilot, Azure OpenAI, Azure Web Services, Azure Functions, Azure Logic Apps, Blazor Web Assemblies, C# and requirement analysis.

Why Enable Auditing?

Auditing in Microsoft Dataverse helps in maintaining a log of all data changes. This is important for:

  • Maintaining a history of data modifications

  • Meeting compliance and regulatory standards

  • Troubleshooting data integrity issues

Enable Auditing in Dataverse

System Settings:

Enable Table-Level Auditing:

  • Select the table (e.g., Account)

  • Enable “Audit changes to its data” in the table properties (Advanced Options)

Enable Column-Level Auditing:

  • Select individual columns (e.g., Telephone1)

Enable the “Enable Auditing” option

Create Power Automate Flow to Retrieve Audit Data

  1. Trigger: Use When a row is modified for the table you are tracking.

  2. List Audit Records:

    Query Expression:

     objecttypecode eq 'account' and _objectid_value eq 'triggerOutputs()?['body/accountid']'
    
    • Add a List rows Dataverse action

    • Use this OData filter query:

    • Sort by createdon desc

  3. Parse Audit Data:

    1. Use a Parse JSON action:

      Content expression:

       first(outputs('List_rows')?['body']?['value'])?['changedata']
      

      Response:

       {
         "OldValue": {
           "field1": "Old Value 1"
         },
         "NewValue": {
           "field1": "New Value 2"
         }
       }
      
  4. Extract Old and New Values:

    1. Use a Compose action with below expression:

       outputs('Compose')?['changedAttributes'][0]['OldValue']
      
       outputs('Compose')?['changedAttributes'][0]['NewValue']
      

Conclusion

Audit logs provide a transparent trail of changes made to data within Dataverse. When combined with Power Automate, they empower users to create intelligent flows that not only respond to changes but also reference historical data. This setup is particularly valuable for quality control, approvals, and governance automation.

We hope this guide helps you understand how to retrieve old and updated data using audit logs in Power Automate. Feel free to leave a comment or reach out for further assistance.

More from this blog

C

Clever Wizard | Mastering Solutions

10 posts

A blog dedicated to simplifying complex business scenarios using Dynamics 365 CE, Power Platform, and Azure, empowering developers and organizations to implement innovative solutions with ease.