Just wanted to write this down so I don’t forget how to do this, if this helps someone else out even better!
If you’re wanting to access the Created By, Created On, Modified By and Modified on information on a custom list form in SharePoint 2010 or 2013, you can do this using the SharePoint:CreatedModifiedInfo control and use the CustomTemplate element, like so:
SharePoint uses the field names Author, Created, Editor and Modified to refer to the following:
Author: Created by
Created: Date Created
Editor: Modified by
Modified: Date last modified
You can include any combination of these fields and any other HTML/CSS to adjust the layout as needed either inside or outside of the CreatedModifiedInfo control. If you want to separate out the fields into separate areas of the page, you will need to repeat the control pattern of SharePoint:CreatedModifiedInfo->CustomTemplate->FormField for each section.
Hope this helps!
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!