cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
R3dKap
Super User
Super User

Detect when list item is loaded in custom SharePoint list form

I customized a SharePoint list item with Powerapps.

 

Once published, I noticed that when you double-click on a list item, the item data don't show up immediately in the form fields but only after a few seconds or miliseconds (which means that if you jump from one list item to another, you see the previous item data for a few seconds -> not very nice).

 

Anyone knows a way to detect when the data for the selected item has indeed been loaded ?

 

Is there a way to clear all fields in the form every time the form is shown (so it looks empty while it loads the item's data) ?

7 REPLIES 7
v-micsh-msft
Community Support
Community Support

Hi @R3dKap,

 

The SharePoint List form is using a way to determine whether the data has been loaded by the method below (Under the Item property of the Form control):

If(IsBlank(SharePointIntegration.Selected) || IsEmpty(SharePointIntegration.Selected),First(List1),SharePointIntegration.Selected)

The default loading experiences from my side for the View Form is as below:

SPFormLoading.gif

 

 

And as the Formmode is Formmode.New, the SubmitForm and ReSetForm would have no effects.

So there is no way based on what I know, to clear those fields before loading for another item.

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-micsh-msft,

 

As you can see on your GIF, there is a small latency on the form before the values of the preivous edited item are replaced by the ones ffrom the selected item.

 

When the OnEdit event of the SharePointIntegration object or the OnVisible event of the screen are triggered they hold the values of the previous item, not the real selected one (at least for a few milliseconds).

 

Is there any wa around this ?

There really should be some signal or event that says the form is ready, the correct data is now loaded into the form.

 

Now I need to have a timer wait before doing something, but I don't really know how long.

michelsmpit
Frequent Visitor

I fully agree, this is the only missing link I have for creating an inline repeating section in my form. Since this repeating section works with a collection, I need a point to convert a field value to a collection (by splitting strings e.g.). I'm able so do this in an OnSelect of a button, but ideally I want this to happen automatically when the ListItem is loaded... That few milliseconds delay doesn't help 😉

R3dKap
Super User
Super User

I've put up the following workaround for now:

  • add the ID field on the form and hide it
  • set the visibility of the form to this:
SharePointIntegration.SelectedListItemID = Value(DataCardValue5.Text)

...providing DataCardValue5 is the one for the ID field datacard...

michelsmpit
Frequent Visitor

@R3dKap solution works great for hiding and showing things, but I need a trigger point to trigger a conversion from a string value to a collection, to get a repeating-section like behavior. 

Capture.PNG

R3dKap
Super User
Super User

@michelsmpit you could put the formula I mentionned above ( SharePointIntegration.SelectedListItemID = Value(DataCardValue5.Text) ) into the Default property of a toggle control and then place your conversion formula inside the toggle's OnCheck property... What do you think?

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,912)