0

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?

Sahil Tiwari
  • 159
  • 2
  • 12
  • 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 Jan 21 '19 at 14:17
  • 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 Jan 21 '19 at 14:38
  • 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 Jan 21 '19 at 14:46
  • 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 Jan 21 '19 at 14:50
  • You can also refer this thread if you want to understand more clearly:https://stackoverflow.com/questions/54241538/unable-to-save-new-record-to-the-sharepoint-list/54249905#54249905 – Sahil Tiwari Jan 21 '19 at 14:51
  • However, now I am left with the mentioned issue here. Rest all(mentioned in the above thread) issues are gone. – Sahil Tiwari Jan 21 '19 at 14:53
  • I see. I would like to know how do you fix the previous issues, maybe the problem is there. – Brank Victoria Jan 21 '19 at 14:57
  • Yes, the content-type field wasn't mentioned there previously. So I enabled it and it got me rid of entry related issues. Now only the 'save' issue exists. – Sahil Tiwari Jan 21 '19 at 15:16
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/187059/discussion-between-brank-victoria-and-sahil-tiwari). – Brank Victoria Jan 21 '19 at 15:17

2 Answers2

0

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

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
}
Sahil Tiwari
  • 159
  • 2
  • 12