cancel
Showing results for 
Search instead for 
Did you mean: 
Inogic

Power Pages: How to Track Changes by Contact (Portal User) in Dataverse Auditing

Introduction

Power Pages sites, connected to Dataverse, serve as a powerful tool for modern website development. Dataverse, acting as a versatile database, offers security features, analytics, and automation. However, Dataverse auditing, which logs changes to customer records, initially poses a challenge as it records actions under the application/system user, rather than the actual contact (portal user) making the changes. The application user will be in the format # Portals-<<site name>>. You can see in the screenshot below of Dataverse auditing for application user # Portals-<<site name>>.

 

1Dataverse Auditing.jpeg

Challenges in Tracking Portal Users

The default setup lacks information about the contact performing operations, leaving organizations in the dark about the user making changes to records in Power Pages sites. The solution lies in a straightforward configuration to associate the portal user using basic form metadata for portals.

Configuration Steps

Create Look-ups: Begin by creating look-ups for contacts on the tables being created or modified. If distinguishing between created by and modified by, separate lookups are needed.

 

2Dataverse Auditing.jpeg

Configure Entity Form Metadata

Follow these steps to configure basic form metadata for portals:

  1. Open the Portal Management app.
  2. Select the desired form from Entity Forms under the Content section.
  3. Navigate to Entity Form Metadata.
  4. Create new metadata.
3Dataverse Auditing.jpeg
 
Entity Form Configuration

For an Entity Form configured for a table (e.g., Order), create new metadata of type attribute for the lookup attribute. Set the “Set Value On Save” to associate the current portal user as the contactId for the form attribute.

 

4Dataverse Auditing.jpeg
5Dataverse Auditing.jpeg

 

We have completed the configuration. Now, if someone updates or submits the form on the portal, the value of the portal user/contact will be audited in Dataverse auditing.

 

6Dataverse Auditing.jpeg
 
Additional Settings

To log the created by contact value, ensure to associate the current portal user on the insert section of the Entity Form’s additional settings tab.

 

7Dataverse Auditing.jpeg
 
Conclusion

In the realm of Microsoft Power Pages and Dataverse, the ability to track changes by Contacts (Portal users) in the auditing process is crucial for comprehensive data management. This blog has provided a step-by-step guide to overcoming the limitations, offering advanced configurations for enhanced user-specific auditing. By implementing these measures, organizations can ensure a transparent digital experience, aligning with the evolving landscape of low-code application development and data governance.

Additionally, for a deeper understanding of basic form metadata configuration, you can explore Microsoft’s documentation on Configure basic-form-metadata.