Manage Created & Modified info on custom form in XSLT

Manage Created & Modified info on custom form in XSLT

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:CreatedModifiedInfo ControlMode="Display" runat="server"> 
        <SharePoint:FormField FieldName="Author" runat="server" ControlMode="Display" DisableInputFieldLabel="true" />
        <SharePoint:FieldValue FieldName="Created" runat="server" ControlMode="Display" DisableInputFieldLabel="true"/> 
        <SharePoint:FormField FieldName="Editor" runat="server" ControlMode="Display" DisableInputFieldLabel="true" />
        <SharePoint:FieldValue FieldName="Modified" runat="server" ControlMode="Display" DisableInputFieldLabel="true"/>

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!

4 thoughts on “Manage Created & Modified info on custom form in XSLT

    1. No, I haven’t tried that. How would I can incorporate that into the ‘CustomTemplate’ code in your post?

      1. Sorry for the delay…You can add that code snippet above to any area of your custom list form inside of the tags. Just replace the @Datefield with the actual name of your field you want to display.

  1. Thanks for the tip.

    I found I needed to use FieldValue for Author and Editor instead of FormField otherwise nothing would display.

    Also the date fields (Created/Modified) displayed in the wrong timezone … looked like everyone was updating stuff at 1am! Any ideas?

Comments are closed.

Comments are closed.