In Power Apps, tracking list item update history while using the offline feature can be challenging since the offline mode allows users to modify data on their devices without immediate synchronization. However, you can implement a custom solution to record the update history. Here's a high-level approach to achieve this:
1. Add Audit Columns to Your Data Verse Table:
In your Data Verse table (SharePoint list or Common Data Service entity), add additional columns to store audit information. For example, you can add columns like "LastModifiedBy," "LastModifiedDate," and "OfflineStatus."
2. Custom Patch Function for Offline Updates:Create a custom Patch function to handle updates to the data when the app is offline. In this function, not only update the list item data but also update the "LastModifiedBy" and "LastModifiedDate" columns to record the user who made the update and the timestamp of the update.
3. Offline Conflict Handling:
When the app comes back online after both you and your teammate made offline updates, you will need to handle potential conflicts. Power Apps might not automatically resolve conflicts for you. You can use the "OnVisible" property of the screen or other appropriate triggers to detect if the app is online, and if so, implement conflict resolution logic. For example, you can check the "LastModifiedDate" and "LastModifiedBy" columns to see which update should take precedence.
4. Sync and Merge Data:
When the app comes back online, use the built-in synchronization mechanism in Power Apps to sync the local data with the server data. During the sync process, implement a merge strategy to resolve conflicts if necessary.
5. Record Offline Status:
You can also utilize the "OfflineStatus" column to indicate whether a particular item has been modified while offline. This column can be updated when the app goes offline and reset when it comes back online.
6. Store Audit History:
Additionally, you can create a separate audit history table to record all updates to the main table, including the timestamp, user, and changed values. This way, you'll have a comprehensive log of all modifications to the list items, both online and offline.