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 } } )
On another app, I got the same error:
"An entry is required or has an invalid value. Please correct and try again."
In this case, I didn't have an ID field on the form. In this case, I had a Title field displayed as read-only. It was a required field, but I didn't create new items using this form, so I needed this field to be read-only. When I flipped it back to editable, the error went away. So my workaround was to change the visible property to hide the field and to display the Text of that field using a Label control. All is well in my form universe again.