I have a PowerApps form integrated with a SharePoint list. It has two forms, one of which allows entry of a new item (works fine), and the other form allows editing of the selected item. In edit mode, no matter what item the user intially selects from the list, the fields in the form are filled in with the "First" list item. I think this is happening because of the if statement in the form properties:
If(IsBlank(SharePointIntegration.Selected) || IsEmpty(SharePointIntegration.Selected),First(DailyPhoneLog_Query),SharePointIntegration.Selected)
It appears that even though an item is selected, the form is interpreting the item or its ID as blank, and thus reverts to the First list item to display in the data cards/fields.
I have another list where I originally created this app from, where it works perfectly. I used the export package feature, then imported the app package into this list, then modified the data sources, etc.
Any help or insight would be appreciated.
Solved! Go to Solution.
I think the fix you found is your best bet. That user reports success!
When you delete the datasource, it deletes it from the app, but it is easy enough to add back in. However, I am sure the user who posted the fix would have tried that.
I have found a quick way to get the correct item to show, I think, but again... I think correcting the root cause is always a better idea than attempting workarounds like this. For info, I will post it anyway:
Set the Item formula of the edit form to:
First(Filter('My Data Source', ID = SharePointIntegration.SelectedListItemID))
Your formula looks correct, have you checked the SharePointIntegration 'OnEdit' property to make sure it is doing what you expect it to?
For troubleshooting, you could add a label to your edit form and set it's text value to SharePointIntegration.SelectedListItemID just to see what ID, if any is being shown as selected, and also that the edit form being displayed is the one you expect....
yes, I just added a button to notify me of the SharePoint ID, and it looks like the SelectedID is correct, but the cards/data fields are reverting to a different ID (possibly 1). Shows the same one every time. Screenshot from one of the cards, which should pick up the current Item value for that specific column in SharePoint (see screenshot). the odd thing is that I have a nearly identical list and powerapp that works. I exported the app as a package, inserted it into this list, revised everything, and now it works except for picking up data from an existing record.
Each data card has overall properties of the card, then individual properties of the label and value elements within the card. In my case, the data card overall property for default is ThisItem.<<datafieldname>> which tells the card which data field/column in the SharePoint list to attach to. Then the "value" element of the card, which is the area where the result is displayed, is set to Parent.Default.
It does seem like the form should be working.
For testing, although it seems pointless, you could change the item formula for the edit form and remove the if statement, just write in SharePointIntegration.Selected.
Also you could add a few labels and display some of the items field values using SharePointIntegration.Selected.CallerAddress etc. Just to see if your edit form can access the field values.
Maybe the import has messed up your edit form?
Thanks very much, good ideas. I gave both fo your suggestions a try.
1. Changing the formula to remove the If statement and just "SharePointIntegration.Selected" resulted in "Getting your data." So it seems that the SharePointIntegration.Selected is returning blank or empty, even though we are selecting an item from a SharePoint list.
2. Tried adding a label with a value of SharePointIntegration.Selected.CallerAddress, but that returned blank.
I am suspecting there is something hidden in the code resulting from the original app export, and then import into a new list. In the error checking, I see these errors related to SharePoint Integration. I was hoping to avoid completely deleting this integrated form, and starting over, but I may have to start from scratch. I even tried inserting a new, blank screen, then a new form, and then tried adding one field, but still had the same issues.
Have you tried deleting the datasource?
It might be worth a try. Delete the datasource, save the powerapp and then try re-adding it, that might give it a kick to re-create whatever .SelectedHidden property is...
I found this a possible solution by a user: https://powerusers.microsoft.com/t5/Building-PowerApps-Formerly/fix-an-error-in-SharePointIntegratio...
When I looked deep into the JSON files, I indeed found one reference to the list from which I exported the app originally, so I need to change that reference to the new list, then re-import the entire app package again.
Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.
Your chance to join an engaging competition of Power Platform enthusiasts.