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

Form startup on first position

So I customized a SharePoint form with canvas powerapps. I did the multiple tab thing as per Laura Rogers tutorial (https://www.youtube.com/watch?v=NdiQ802dG3E in case you don't already know it).

 

The problem here is: When entering the forms editing mode while trying to edit a list element, the app almost randomly starts scrolled to some position of the form. Sometimes it's starting up from the top (at the very first field of the form), sometimes it's just scrolled somewhere in the middle. It doen't seem to depend on

 

- the position, where I saved and published the form at 

- the position where i left off editing the last item by clicking Save 

Tested both.

 

Naturally, we always want it to start scrolled at the very top of every tab. Is there some command to say "when open in edit mode, start at Position 0 (or 1?)"Where would I put it?

2 REPLIES 2
Highlighted
Community Champion
Community Champion

Re: Form startup on first position

adding in @anees to assist with this Form question. 

 

@TopShelf-MSFT

Highlighted
Responsive Resident
Responsive Resident

Re: Form startup on first position

@lumoe

 

I don't think there is a solution for this, although I'd be excited to hear what @TopShelf-MSFT has to say.

 

The problem is that when your SharePoint custom form (aka PowerApps canvas app) opens up for the first time, it instantiates (e.g. it triggers the OnStart, OnVisible events, etc.). After that, even after you close the form, it remains a floating--but active--session. When you choose a different record (view or edit) or create a new form, SharePoint simply changes the form's Item property.

Note that by default, a custom SharePoint form's Item is set to:

SharePointForm1.Item =
If(IsBlank(SharePointIntegration.Selected) || IsEmpty(SharePointIntegration.Selected),First(yourList),SharePointIntegration.Selected)

Simply put, once your canvas app instantiates for the very first time, every subsequent access to it--whether edit, view, or new--is the same session. To refresh your app, you need to either close the web browser tab or refresh it (F5).

I presume the feature behind this is that it saves time. If it didn't do this, your canvas app would have to refresh and reload the datasource each time, which could be a drag.

The con to this is that, like you are experiencing (and like how I've been experiencing), your session will be scrolled where it was last left off. So if you open record #1 and scroll 3/4 of the way down... when you close the form and open record #23, it will open up scrolled 3/4 down. Likewise, if you have a tabular interface (like your tutorial example), if you are on tab 3 on record #3, when you close your form and open up record #50, it will be on tab 3. The same goes for screen, if you have multiple screens.

 

At first, I thought maybe an instruction in the OnVisible event (e.g. shrink the form and then make it visible a gain; navigate to screen1; change tab variable to default; etc.) would resolve the problem; however, the "event" of opening and closing a SharePoint custom form is not recognized by PowerApps, so it does not trigger OnVisible or any other event for that matter. So this strategy does not work.

 

The only strategy I could think of that could possibly work is creating a continuous timer that polls every few seconds:

Timer1.OnTimerEnd=
  If(varLastID<>Value(DataCardValue1.Text),
    doResetEventStuffHere...;
    UpdateContext({varLastID: Value(DataCardValue1.Text)})  
  )

I've never tried this, but only because I'm not a fan of having a polling event. It's inefficient and bad design.

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

Top Solution Authors
Top Kudoed Authors
Users online (8,405)