cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JBL
Frequent Visitor

PowerApps Customized SharePoint List Forms - OnStart and ResetForm() function issue

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?   

1 ACCEPTED SOLUTION

Accepted Solutions

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.

 

View solution in original post

6 REPLIES 6

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.

 

JBL
Frequent Visitor

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.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,142)