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>>.
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.
Configure Entity Form Metadata
Follow these steps to configure basic form metadata for portals:
- Open the Portal Management app.
- Select the desired form from Entity Forms under the Content section.
- Navigate to Entity Form Metadata.
- Create new metadata.
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.
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.
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.
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.