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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Automatically Executin...
Power Apps
Unanswered

Automatically Executing Code When Opening a Custom SharePoint List Form in PowerApps

(1) ShareShare
ReportReport
Posted on by 14

I have developed a custom form for a SharePoint list. I want to execute some code that essentially rebuilds a collection whenever the form opens.

The code itself is correct because it works perfectly when triggered by a button. However, I would like it to run automatically when the form opens, without needing to use a button.

This would allow the data in the custom form to be displayed correctly every time a user opens it from the SharePoint list.

I have tried the OnStart event, as well as the OnVisible event of the form's screen, but it seems that the code is being ignored.

Any suggestions?

Thank you.

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,040 Most Valuable Professional on at
     
    Hi  vigand ,
    Unfortunately, a fundamental functionality of Integrated SharePoint forms that is designed to enhance performance also impedes functions that need to run automatically. You will notice that the OnCancel and OnSave events have RequestHide() as the last command - essentially hiding the form waiting for the next record to open, then unhiding the form and updating the record according to the SharePointIntegration.Selected value. Although OnStart and any screen OnVisible code will certainly run when the first record is selected, it does not for subsequent records as the form is actually still open. The only way to instigate the code runnning is for the user to refresh their browser between each record.
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee
  • vigand Profile Picture
    14 on at

    Thank you WarrenBelz for your response.

    In essence, regardless of everything, any function I start on the custom form will only work the first time and not on subsequent attempts. Therefore, I imagine that even the idea of inserting a timer when opening the form wouldn’t solve the problem.

    I must say that I expected it to be something structural, but it is quite surprising that it is allowed to build a custom form only to limit it so significantly.
     
    Best regards
     
  • Verified answer
    WarrenBelz Profile Picture
    153,040 Most Valuable Professional on at
    Hi vigand ,
    The fundamental idea behind an integrated form is a replacement for the "standard" SharePoint form with simple Add/Edit/New functions with the idea that users would simply be opening a record, doing something and then opening another one. It was very inefficient performance-wise to have to open the app every time a user changed records, so the Form is simply hidden and made visible again when the next record was selected, allowing very fast and efficient record management. Consequently OnStart and OnVisible do not run (as they would not in a Canvas App if you simply change the record without leaving the screen).
    There are other reasons I can speculate on (a SharePoint List can be shared with users without any licence) where full Canvas App functionality would not be included (there are other areas as well as this one). 

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard