Customizing default sharepoint form in powerapps doesn't save after publishing to sharepoint

1.5k views Asked by At

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?

2

There are 2 answers

0
Sahil Tiwari On

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:

{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
   Claims:Concatenate("i:0#.f|membership|",User().Email),
   DisplayName:User().FullName,
   Email:User().Email
}
1
Babatunde Akande On

How are you trying to save it to the list? Are you using SubmitForm or Patch? If it is Patch there is a way you might need to pass some values into some kind of columns which might be causing the error