cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ChristopherWood
Regular Visitor

Audit Records

Hello, 

 

I am very new to PowerApps and still learning - Please bear with me. 

 

I have built an app, for a reporting system, it logs the date and name to separate fields in lists when it gets editted. 

 

I want this to populate a seperate field which will act as a historic audit log. 

 

Is this possible? Can anyone guide me how to do this?

 

Thanks 

1 ACCEPTED SOLUTION

Accepted Solutions
Drrickryp
Super User
Super User

@ChristopherWood 

There are several ways to do this but one way is to create a separate audit log list and when the user saves the form, in the OnSuccess property of the form: Patch(auditlist, Defaults(auditlist),{ID:Self.LastSubmit.ID, Field1:Self.LastSubmit.Field1, Field2:Self.LastSubmit.Field2, Datefield:Now(), Userfield:User().FullName ...}).   Be aware that these audit lists can grow to be very large. 

 

View solution in original post

4 REPLIES 4
Drrickryp
Super User
Super User

@ChristopherWood 

There are several ways to do this but one way is to create a separate audit log list and when the user saves the form, in the OnSuccess property of the form: Patch(auditlist, Defaults(auditlist),{ID:Self.LastSubmit.ID, Field1:Self.LastSubmit.Field1, Field2:Self.LastSubmit.Field2, Datefield:Now(), Userfield:User().FullName ...}).   Be aware that these audit lists can grow to be very large. 

 

ChristopherWood
Regular Visitor

Hi, Thanks for the reply. looking at this it has thrown up some errors when trying to locate the source. 

 

My list is called BNSOR

 

below you can see I wish for the data to be entered into the field Audit Log of that record.

 

ChristopherWood_0-1652427566040.png

 

ChristopherWood
Regular Visitor

Here is the code editted to match my fields. 

 

Have I made a fatal error?

 

Patch(BNSOR, Defaults(BNSOR),{ID:Self.LastSubmit.ID, Modified:Self.LastSubmit.Modified, Modified By:Self.LastSubmit.Modified By, Modified:Now(), ModifiedBy:User().FullName ...}))

v-xiaochen-msft
Community Support
Community Support

Hi @ChristopherWood ,

 

You can not update these fields.(ID,Modified,ModifiedBy... ) because they are created by system and read only.

Please try to follow @Drrickryp 's solution to create a new list and some custom fields to store your logs.

 

Best Regards,

Wearsky

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.

Top Solution Authors
Users online (1,351)