Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm trying to create a IT ticketing system. Currently, all users are allowed to create new items (incidents). This is somewhat problematic because everyone sees every column, like "Status" and "Completing Date".

So I want to make some columns visible only to certain users, or group. Is it possible in Sharepoint 2010?

share|improve this question
add comment

4 Answers

up vote 2 down vote accepted

One approach I've used to do this previously to make the columns dynamically displayed based on the current users permission is to use javascript to hide the required html and activate it based on the current users permission using the SPSecurityTrimmedControl.

You just need to modify and place the below script below the LFWP on the edit and new form pages for the list using SharePoint designer.

<script type="text/javascript" language="javascript">
    var hideFields = true;
</script>
<SharePoint:SPSecurityTrimmedControl ID="fieldTrim" runat="server" PermissionMode="All" PermissionContext="CurrentList" Permissions="ManageLists">
<script type="text/javascript" language="javascript">
    hideFields = false;
</script>
</SharePoint:SPSecurityTrimmedControl>
<script type="text/javascript" language="javascript">
function HideSPField(fieldTitle) {
    var elems = document.forms[0].elements;
    for (var ix=0; ix < elems.length; ix++) {
        var elem = elems[ix];
        if(elem.type != 'hidden' && elem.title == fieldTitle)       
            elem.parentNode.parentNode.parentNode.style.display = 'none';
    }
}
if(hideFields)
{
    HideSPField('Sample 1');
    HideSPField('Sample 2');
}
</script>
share|improve this answer
    
Note: Actually, this is a client-side approach, so it's not really a secure one. User could open page source code, or disable js, and he will see the hidden items. In some situations it doesn't matter, but you should always keep it in mind... Also, the code above is only for list forms, like Edit Form and New Form, and not for list view or Display Form. –  Andrey Markeev May 30 '11 at 7:06
    
That's a very important point, thanks for that omlin. Although using SharePoint with javascript disabled would be an interesting experience! :) –  Michael M May 30 '11 at 23:09
add comment

Sure. It depends on how you'd prefer to do it.

I would switch from the standard List Form Web Part (LFWP) in the page to a Data View Web Part (DVWP). There are plenty of instructions and examples on this around the Web. Once you've got the DVWP on the page, you can customize the XSL to show whichever columns you'd like.

share|improve this answer
add comment

Also u can create custom content type with custom aspx pages or custom rendering templates

Where are a log of samples around the Web by queries 'sharepoint content type custom form template' or 'sharepoint content type custom form page'.

share|improve this answer
add comment

I've just done a similar thing to what avishnyakov suggests by creating 2 new content types for my custom list. Then I can:

  • specify which columns to appear in the Edit form for each content type (in my case Employee[Item], Approver 1, and Approver 2)

  • use a Sharepoint Designer workflow to change the content type after each user submits the form

  • use javascript to hide the content type field on the form and validate certain things

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.