Forum Discussion
How to Update a Field through a button's OnSelect Event
I was getting a nasty error on submit with the last solution: "An entry is required or has an invalid value. Please correct and try again." If you click on Submit again, the error goes away.
Others have discovered that this error is caused by having the SharePoint List ID field on the form. I removed it and it went away. However I need to access the ID to use Patch. So I dug and found I can get the ID from the SharePointIntegration Object as the property SelectedListItemID.
Works and no submit error message.
Patch('Store Task Template', First(Filter('Store Task Template',ID=SharePointIntegration.SelectedListItemID)), { Status:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference", Value:"Complete", Id:1 } } )
Good to see you found a working solution, just an FYI on your code you might be able to replace the First(Filter('Store Task Template',ID=SharePointIntegration.SelectedListItemID)) with Lookup('Store Task Template',ID=SharePointIntegration.SelectedListItemID) which is essentially the same thing but easier to follow.
https://docs.microsoft.com/en-us/powerapps/functions/function-filter-lookup
Nice work!
- DeletedDec 13, 2017
Thanks Peter,
I tried substituting the Lookup for the Filter and could not resolve the syntax errors. I'm good for now. I'm pretty happy with the progress over a couple days in learning this from scratch.