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

SharePoint Integration Custom Form - ViewForm displays the previously selected item?

Hi all, I need some help with a SharePoint list and the Power Apps integration.

 

The Setup:

I'm using a custom Power Apps form on a SharePoint list using the list's Integration feature. I have my App.OnStart doing a few things including setting a global variable, varFormData, to Blank(). Then the SharePointIntegration.OnView and OnEdit properties both Set(varFormData, SharePointIntegration.Selected) and the Item property of all my edit forms set to varFormData.

 

The Problem:

When publishing the Power App Form back to the list, it's like there is a 1 item delay in the data shown on all the View Forms. For example, when the Power App custom form starts and I select an item from the list to view, it pulls in the very first list item in the View Form (item ID 1). However, if I select a second item then the View Form updates with the info of the previously selected item, and so on and so forth. The weird part though is that if I select the Edit button (which sets all the forms to Edit Mode using the SharePoint Integration.OnEdit property), all the Edit forms then update with the correct selected item's information. Then of course I have OnSave to patch all the edit form's updates back to the List.

 

What's going on with the OnView part of my custom forms? Any help is much appreciated. Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @rhelder ,

Try setting the Item of the Form to 

LookUp(
   SPLIstName,
   ID=SharePointIntegration.Selected.ID
)

I have had issues also with OnStart Variables refreshing.

 

Please click Accept as solution 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 Thumbs Up.

 

View solution in original post

3 REPLIES 3
WarrenBelz
Super User
Super User

Hi @rhelder ,

Try setting the Item of the Form to 

LookUp(
   SPLIstName,
   ID=SharePointIntegration.Selected.ID
)

I have had issues also with OnStart Variables refreshing.

 

Please click Accept as solution 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 Thumbs Up.

 

View solution in original post

Thanks @WarrenBelz, this worked perfectly!

 

Was wondering if you could also shed some light on how the SharePoint Integration and its properties work:

  1. When using the custom form through the List's SharePoint integration feature like this, when does the App.OnStart property run? Is it when the List loads or when an item is selected and an action is taken against it (i.e. View or Edit), or is it something else completely?
  2. What is the difference between SharePointIntegration.SelectedItemID and this lookup function? They both seem to accomplish the same thing?

Hi @rhelder ,

  1.  I have experienced issues with OnStart variables (not) refreshing if another record is selected without refreshing the SharePoint list each time, so I do as I posted for the form.
  2. They are the same thing.

 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,931)