web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / File attachment remova...
Power Apps
Unanswered

File attachment removal - Activity tracking for audit trail

(0) ShareShare
ReportReport
Posted on by 71

Hi 

I have designed a Canvas app for customer records tracking with Gallery and Form with file attachment control.

On left hand side I have Gallery with customer names and on right hand side form.

The form is linked to gallery so user can select customer names from gallery and view customer record in form.

The form has customer name, address, other details and file attachment control.

 

I am allowing user to add/remove one or multiple files and save the attachments to dataverse when user submit the form.

User can add one or multiple files to each customer record form attachment control and save the form.

User can add/remove one or multiple files from each customer record and save the record form.

 

I am keeping track of audit trail of total files attached, file names and file attachment timestamp by each user and savin it in data table and showing these details on HTML text control. 

 

I am struggling with specific 2 scenarios:

 

a) I am unable to keep track of the user activity when user removes one or multiple files from the Form attachment control and does not save the form intentionally/unintentionally and navigate to another screen of the application.

 

b) I am unable to keep track of the user activity when user removes one or multiple files from the Customer A record Form attachment control and does not save the form intentionally and select another customer (Customer B, C, D, n,) record from the customer gallery and repeat the (b) activity one or multiple times.

 

In both (a) and (b) situation, I am unable to find out which specific user removed the file and how many files are removed from each customer records by user from attachment control and timestamp of file(s) removal.

 
I experimented with OnRemoveFile function of file attachment control and unable to solve the (a) and (b) issues.

Request: Any ideas, suggestion, workarounds or advice will be appreciated.


@WarrenBelz @LaurensM @Drrickryp @iAm_ManCat 

Categories:
I have the same question (0)
  • Shaheer Ahmad Profile Picture
    2,194 Moderator on at

    OnRemoveFile Property: Use the OnRemoveFile property of the file attachment control to update the variable.

     

    OnRemoveFile = Collect(varRemovedFiles, ThisItem.FileName)

     

    Save the Variable: When the form is submitted, save the variable to your audit trail.

     

    Collect(
     YourAuditTable,
     {
     User: User().FullName,
     RemovedFiles: varRemovedFiles,
     Timestamp: Now()
     }
    )

     

  • BradAugustene Profile Picture
    71 on at

    @ShaheerAhmad Thanks for suggesting a solution. It is a good solution

    Your solution will work to some extent. It may not solve scenario #1 as user is not saving the form and intentionally navigating to another screen of the PowerApps application.

     

    Few more scenarios:

    Scenario: 1-A

    I also cant track which specific screen user has navigated to. If we can track that user has navigated to another screen then we can trigger the Form save action and use your collection and save the details.


    Scenario: 1-B
    I am unsure of how many minutes or hours user will be on current screen after removing file from attachment control and when user navigated to another screen so that I can trigger form save action.


    Scenario: 1-C
    Another situation could be that user will intentionally remove the file from attachment control and will never navigate to another screen (User may intentionally close the application or will keep application open) so in this situation we cannot even trigger Form save action. 

     

    I am exploring following experiment:

    My experiment solution is also not 100% perfect but exploring so exploring some ideas here.


    I will save User details, Timestamp in a global variable. (I could not add file name of the removed file as I dont know which specific file user has removed from total xx files in form attachment control).

    I will save the global variable details into audit tracking database table if user clicks save button on current scree or any other screen of the application. 

    Unsolved situation: If user does not click on SAVE button on current screen or on any other screen then my global variable details will never be saved in audit tracking database as my plan to save global variable details depends on user clicking SAVE button on any other screen of the application.

     

    Any suggestions or better solution ideas please....

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 305 Most Valuable Professional

#2
11manish Profile Picture

11manish 212

#3
Valantis Profile Picture

Valantis 167

Last 30 days Overall leaderboard