SharePoint: Show/Hide fields in the form depending on user

We currently have a SharePoint 2010 List wherein we expect members of the team to enter their records, but at the same time we wanted to be able to score their entries. The downside is, with the default settings of the list, the score field is also available to the rest of the team and so they can revise their own scores. After a bit of googling, I found a solution that works. It involves creating new forms and conditional formatting using the SharePoint Designer. The end result was that if the owner of the list accesses the forms, the Score field is displayed; and it is hidden otherwise.

The summary of steps are as follows, but the more detailed steps are in the file attached.

  1. Open your list in the SharePoint Designer.
  2. Create new forms for new, edit and display modes, and set these as the default forms.
  3. Edit each of the custom forms you created – enclose the section that you want to hide in this tag:
    <xsl:if test="ddwrt:IfHasRights(2048)">
    </xsl:if>
  4. Save your changes.

I used the permission mask “2048” as it corresponds to the permission to Manage Lists.  Other parameters can be found in the second link under references below.

References:
http://sharepoint.indigoreality.com/2012/05/04/sharepoint-2010-hide-a-specific-column-from-users/
http://sharepoint.indigoreality.com/2012/05/04/sharepoint-2010-ifhasrightspermissionmask/

One thought on “SharePoint: Show/Hide fields in the form depending on user

Leave a comment