R – Why can’t I see the Author, Created, Editor and Modified fields in a Sharepoint Custom List Form

sharepointsharepoint-designer

So, I have a requirement to hide a field in a Sharepoint custom list based on the creator of the item. I've gone through the steps outlined here and it works great for hiding the field based on permission level. However, I need to be able to show the field if the user has a certain permission level OR is the one who created the item in the list.

Although the fields are listed in the DataViewSource, if I look at the XML that is being returned to render, it includes every field except the four above. Even Sharepoint Designer thinks it should work as it creates the following conditional rendering based on the "Created By Equals [Current User]" in the GUI:

@Author = $UserID

And yet the @Author field doesn't exist. I guess I could set the list to show only the items that the current user has created, but it would be helpful in this case for users to see others' items. Another "nice to have" would be not showing the field once a certain time has passed between the creation date, which again, would mean I'd need to be able to compare with the "Created" field.

Is this by design or am I missing something?

Best Answer

Although I am not certain of the reason why those fields are hidden, or if this solution causes other issues. However, if you change the DataSourceMode from "ListItem" to "List", as shown the example below, the field @Created is now available.

<DataSources>
    <SharePoint:SPDataSource runat="server" DataSourceMode="List" UseInternalName="true" selectcommand="&lt;View&gt;&lt;Query/&gt;....."></SharePoint:SPDataSource>
</DataSources>

The wonder of SharePoint and its beautiful design tool.