While working on a custom form the other day, we noticed the form that was working fine was suddenly throwing the following error:
“The data source control failed to execute the insert command”
Without anything to go off of we started comparing version history in the form, comparing source control versions, searching online, nothing really worked. It ended up being a combination of several things.
First, make sure your XSLT databinding parameter matches the type of databinding you’re doing. For example, there are three types of databinding parameters available in the SharePoint:FormField control:
i = Insert Used for NewForm pages
u = Update Used for EditForm pages
d = Delete Self-explanatory
Therefore, if you’re adding a FormField control to a NewForm page, you wouldn’t want to use the ‘u’ parameter in the ddwrt:DataBind() function, it should be as follows:
Likewise, your EditForm page would look like this:
In addition to this, the other issue was there were site columns that were deleted but still being referenced in the form template. Either locating those site columns in the template and commenting them out or removing them altogether, or re-adding them to the site columns page solved the problem.
Another possibility I found was after applying an update (or through changes from troubleshooting) you may find the SPDataSource for the form’s DFWP is changed to:
The DataSourceMode is supposed to be:
There could be other reasons for this error, feel free to add them to the comments below. Hope this helps!