0
votes

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
As far as I know there is no way to debug what you are sending. You checked that the data inside the form are in a correct format? Probably in one of those fields sharepoint is expecting a number and you are sending a letter, for example..Brank Victoria
I have content-type enabled in my form. Do I need to mention it somewhere like as a 'Patch' while saving the form?Sahil Tiwari
As far as I know if you have connected Sharepoint to Powerapp if you have add the Form item to your screen in the settings it must contain a setting such as "Data object or Type" (not remember the exact name). You are creating your form like that right? Or you have add one by one the EditText and so?Brank Victoria
Yes you are right. I am able to view Content-type field which I enabled too but no use. I actually clicked on 'customize' icon of default sharepoint edit form which took me to powerapps and after publishing, my form doesn't save the way it used to after adding column data. I can't understand where it is going wrong as there's no source of debugging in Sharepoint. :(Sahil Tiwari
You can also refer this thread if you want to understand more clearly:stackoverflow.com/questions/54241538/…Sahil Tiwari

2 Answers

0
votes

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

0
votes

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
}