Previously I was using a sharepoint default form to send a request to my client. I was always able to fill all the fields in default form(fields being appointment type, reason, requested date, due date, and a person/group field called Client) and send it to client approval by workflow that was operating after 'Save' and it was working. However when I tried to customize my form using powerapps by adding one dynamic textfield that calculates the difference in the due and requested dates excluding holidays and weekends, my form doesn't save in sharepoint and I get a message like 'There was a problem saving your changes. The data source may be invalid.'
When I checked out the data source, it was all good. Each field especially required fields of my form has been given correct values. I don't understand where I am going wrong.
Is there any way of debugging this? How can I check out the json after the form submits and throws error? Or is my approach wrong?
It was my fault. There are two person/group fields 'Created By' and 'Modified By' in my list that also needed to be populated too. At first I was using the default value ThisItem.'Created By' for 'Author' or 'Created By' column but this was incorrect. While saving the form(that is you are calling onSubmit('form name'), add following in PATCH function for Author(Created By column) and Editor(Modified By column) along with required fields: