Find UserGroup and Filter Lookup Column According to Group Permission in SharePoint 2010


This article introduces how to find or check a user group and filter Lookup column depending on group permission in SharePoint 2010 using spservices (jQuery).

Detailed Procedure

Step 1

Create a SharePoint site.

Step 2

Create a user group and add one user to the group, for example I have a user group Management and user Laxman vyavahare as shown bellow:

Creating User Group in SharePoint Site

Step 3

Create two lists, namely Status and FilterStatus.

  • The Status list contains the two column Title and Active (bool type) and add an item as in the following figure:

    Creating Status List in SharePoint Site
  • Create a FilterStatus list that contains 2 columns, Title and the other is a lookup column on status list as in the Figure.

    Creating FilterStatus List

Step 4

Click on the Add new item link button and see the lookup column; here you can see the following 4 options:

  • Approved
  • Rejected
  • Open
  • Closed

Filter Status

But the Management user group has only access for Approval and Rejection so how I can hide (or by filter lookup column) open and close status from the management user group.


Step 5

Open the FilterStatus list in the Designer and add the following lines of code on NewForm.aspx or EditForm.aspx page under the <script> tag as below:


  1. <script type="text/javascript" src=""></script>  
  2. <script type="text/javascript" src=""></script>  
  3. <script type="text/javascript">  
  5. $(document).ready(function () {  
  6.     alert('hi');  
  7.     $().SPServices({   
  8.         operation: "GetGroupCollectionFromUser",   
  9.         userLoginName: $().SPServices.SPGetCurrentUser(),   
  10.         async: false,   
  11.         completefunc: function (xData, Status) {   
  12.             if ($(xData.responseXML).find("Group[Name='Management']").length == 1)  
  13.             {   
  14.                 alert("login inside of the Group user");   
  15.                 $().SPServices.SPFilterDropdown({  
  16.                     relationshipList: "Status",  
  17.                     relationshipListColumn: "Title",  
  18.                     columnName: "FilterStatus",  
  19.                     CAMLQuery: "<Neq><FieldRef Name='Active' /><Value Type='Boolean'>Yes</Value></Neq>",   
  20.                     completefunc: null,  
  21.                     debug: false  
  22.                 });  
  23.             }   
  24.             else {   
  25.                 alert("login outside of the Group user");   
  26.             }   
  27.         }   
  28.     }); /*close().SPServices({ */   
  29. }); /* close (document).ready(function() { */  
  30. </script>  


Step 6

Save both of the .aspx pages of the list and close the designer.

Step 7

Then open your FiltrStatus list and see the effect.

New Filter Status

Now the Management group has access for Approval and Rejection.