Regarding: SharePoint PowerApps Customized Forms
PowerApps has a Screen / OnStart event that may be used to populate collections or set variables on load.
I’ve recently discovered an issue, where the OnStart event is triggered only once on the first item a user edits in a SharePoint list. If a user opens a second item OnStart does not trigger.
Behavior:
1. User edits existing form – OnStart is triggered
2. User saves or cancels form
3. User opens new form - OnStart does not trigger – global variables are set to values from previous load
4. User saves or cancels form
5. User opens second existing item – OnStart does not trigger
To recreate the issue spin up a simple list with a few columns, create a PowerApps Customized form for the SharePoint List.
1. Go to OnStart under “…Screen” for the form and create a global variable and set it to Now(): Set(myStartTime , Now())
2. Create a label on the form and set the text property to the start time variable myStartTime
3. Save/Publish
Test:
1. Open the first item or create a new item: Note the date and time
2. Close or Save form
3. Open a second item, the label will have the previous data and time from the last item opened.
2nd Issue:
PowerApps has a ResetForm() function that is called when a PowerApps form is saved or canceled. It initializes controls on the form to default or (current) values of the underlying listitem.
There is an issue with dropdown controls and radio buttons populated from collections. These types of controls will not reset properly and sometimes will display values from the previous item edited.
Has anyone encountered these issues?
Solved! Go to Solution.
From my experience, the OnStart runs only once for Sharepoint List Form PowerApps. If you select another item it does not run. You could use the OnVisible property to change variables once the PowerApp is visible again ( i.e: when you change the selected item in a list ).
For the second issue, I've learned from @mr-dang that, for dropdowns, you need to set a variable for the Reset property that will trigger the actual reset of the control. I have these lines of code in the OnNew property of the SharepointIntegration control:
Set(ResetControls, true); Set(ResetControls, false);
And then, in each dropdown reset property I have the ResetControls variable. Those two lines trigger the reset.
Check and let me know.
From my experience, the OnStart runs only once for Sharepoint List Form PowerApps. If you select another item it does not run. You could use the OnVisible property to change variables once the PowerApp is visible again ( i.e: when you change the selected item in a list ).
For the second issue, I've learned from @mr-dang that, for dropdowns, you need to set a variable for the Reset property that will trigger the actual reset of the control. I have these lines of code in the OnNew property of the SharepointIntegration control:
Set(ResetControls, true); Set(ResetControls, false);
And then, in each dropdown reset property I have the ResetControls variable. Those two lines trigger the reset.
Check and let me know.
That worked, thank you. Turning the value for Reset from false to true will execute the reset of the controls.
Unfortunately, OnVisible only works on first load, the same as OnStart.
Ok, could you please let me know what are you trying to do in the OnVisible?
Hi all. I'm new in PowerApp, but senior developer.
I'm facing the same issue described below, about the OnStart and OnVisible event issue.
Is there a solution to this case?
Thanks.
@PauloRech @JBL @Eickhel Did anyone find a solution to the OnStart or OnVisible only running once when opened from a sharepoint list?
@stujol80 & @PauloRech ,
This is an old closed thread, please post new queries so someone will see and respond to them.
User | Count |
---|---|
253 | |
106 | |
88 | |
51 | |
43 |