Filter a list based on department of current user

I've created a list with a department field populated from a user named in each item. Is there an OOB way to create a 'My Department' view to show those items where the Department field matches that of the current user? I've tried the Current
User filter but this doesn't seem to work (this may be a local problem or that I have multiple views of lists on the same page and I only want to filter on one of these views).
Tom Hamilton

Hi Hamilton,
Thanks for posting this issue, 
Let's try this OOB web parts,
1. Add a tasks web part on your page then add a column named "Department" to this tasks web part and enter some value, say 'Information Technology' as department.
2. add a UserContextFilter web part to same page. Configure it so that it sends "Department" user profile value to Tasks web part. At this point, when you try to connect
usercontextfilter wp to tasks wp, you won't be able to see "Department" in drop down list. Because this drop down list values are populated based on of tasks web part.
I hope this is helpful to you, If this solution works, Please mark it as
Answered.
Regards,
Dharmendra Singh (MCPD-EA | MCTS)
Blog :http://sharepoint-community.net/profile/DharmendraSingh

Similar Messages

  • Drop down list based on log in username - php mysql

    I have a drop down list of client names on a php page that filters a second drop down list of site names.
    At the moment, any user who logs in can see the entire list of clients, however I want to filter the list based on their username log in.
    This is the entire page code, the section in bold is the drop down list in question:
    <?php
    if (!isset($_SESSION)) {
      session_start();
    $MM_authorizedUsers = "asguser,admin,member";
    $MM_donotCheckaccess = "false";
    // *** Restrict Access To Page: Grant or deny access to this page
    function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
      // For security, start by assuming the visitor is NOT authorized.
      $isValid = False;
      // When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
      // Therefore, we know that a user is NOT logged in if that Session variable is blank.
      if (!empty($UserName)) {
        // Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
        // Parse the strings into arrays.
        $arrUsers = Explode(",", $strUsers);
        $arrGroups = Explode(",", $strGroups);
        if (in_array($UserName, $arrUsers)) {
          $isValid = true;
        // Or, you may restrict access to only certain users based on their username.
        if (in_array($UserGroup, $arrGroups)) {
          $isValid = true;
        if (($strUsers == "") && false) {
          $isValid = true;
      return $isValid;
    $MM_restrictGoTo = "accessdenied.html";
    if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {  
      $MM_qsChar = "?";
      $MM_referrer = $_SERVER['PHP_SELF'];
      if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
      if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0)
      $MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
      $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
      header("Location: ". $MM_restrictGoTo);
      exit;
    ?>
    <html>
    <body>
    <script type="text/javascript">
    function AjaxFunction(client_UID)
    var httpxml;
    try
      // Firefox, Opera 8.0+, Safari
      httpxml=new XMLHttpRequest();
    catch (e)
      // Internet Explorer
              try
                        httpxml=new ActiveXObject("Msxml2.XMLHTTP");
                  catch (e)
                    try
                  httpxml=new ActiveXObject("Microsoft.XMLHTTP");
                    catch (e)
                  alert("Your browser does not support AJAX!");
                  return false;
    function stateck()
        if(httpxml.readyState==4)
    var myarray=eval(httpxml.responseText);
    // Before adding new we must remove previously loaded elements
    for(j=document.testform.subcat.options.length-1;j>=0;j--)
    document.testform.subcat.remove(j);
    for (i=0;i<myarray.length;i++)
    var optn = document.createElement("OPTION");
    optn.text = myarray[i];
    optn.value = myarray[i];
    document.testform.subcat.options.add(optn);
        var url="dd.php";
    url=url+"?client_UID="+client_UID;
    url=url+"&sid="+Math.random();
    httpxml.onreadystatechange=stateck;
    httpxml.open("GET",url,true);
    httpxml.send(null);
    </script>
    <form name="testform" method='POST' action='mainck.php'>
    Select first one
      <select name=cat onChange="AjaxFunction(this.value);">
      <option value=''>Select One</option>
    <?
    require "config.php";// connection to database
    $q=mysql_query("SELECT DISTINCT * FROM qry_test GROUP BY client_name ASC");
    while($n=mysql_fetch_array($q)){
    echo "<option value=$n[client_UID]>$n[client_name]</option>";
    ?>
    </select>
    <select name=subcat>
    </select><input type=submit value=submit>
    </form>
    </body>
    </html>
    I think I need to amend the sql statement to something like this - but I haven't quite got it right:
    SELECT DISTINCT * FROM qry_test WHERE username = colname GROUP BY client_name ASC
    Where do I drop the code for the colname info?
    name:colname
    type: text
    default value: -1
    run time value: $_SESSION['MM_Username']
    Thanks!

    I don't do PHP but it would be something like:
    $sql = sprintf (SELECT DISTINCT * FROM qry_test WHERE username = %s GROUP BY client_name ASC, $_SESSION['MM_Username'] );
    or you can just embed the session variable into the sql string.
    But why are you using the GROUP BY clause? If you just need a distinct list of names, use the DISTINCT keyword and reduce your select list to only the needed column.

  • Filter output data according to portal current user name in omni portlet

    We have created an omniportlet that connects to a database, and retrives some values into a defined HTML layout.
    We want to filter output data according to our portal current user name
    When we try to use portal.wwctx_api.get_user inside of omni portlet select statement fallowing error occurs.
    Error in executing Query : [ORA-06510: PL/SQL: unhandled user-defined exception ORA-06512: at "PORTAL.WWCTX_SSO", line 1803 ORA-06510: PL/SQL: unhandled user-defined exception ORA-06512: at "PORTAL.WWCTX_SSO", line 1637 ORA-06502: PL/SQL: numeric or value error ORA-06512: at "PORTAL.WWCTX_SSO", line 1865 ORA-06512: at "PORTAL.WWCTX_API", line 183 ]
    Thanks a lot

    hello
    i think you cannot use the portal built-in packages inside omni portlets. Omni portlets is designed to connect to other data source (not only oracle) and Portal API might not be available at these data sources. Therefore, you should not be using these Packages at all!. i tried very hard, but to no avail.. Omni portlet has its own repository!! if you cannot pass the infomration as a parameter, then find a different approach
    Ammar Sajdi
    Amman - Jordan
    oracle consultant

  • To connect the Current User Filter with the Excel Web Access

    Hello,
    I have uploaded an excel sheet which has data in Pivot table format into SharePoint site and then by using the current user filter I am trying to connect the filter (sharepoint profile user property) to a parameter in the excel sheet. I have defined one
    of the pivot filter as the parameter. But all this, raises an error as below 
    "Unable to set one or more parameters. An error occurred while attempting to set one or more parameters in this workbook. As a result, none of the parameters has been set. Click OK to return to the workbook."
    please assist.
    Thanks & Regards
    Thank You

    I had referred this link but the example provided is related linking dashboard filters with the pivot table filter and i require to connect a current user filter.
    The current user filter does not have any properties similar to what the dashboard filter have and we are not looking at using dashboard for our requirement.
    Thank You
    Thank You

  • Filter omni portlet output data according to portal user

    We have created an omniportlet that connects to a database, and retrives some values into a defined HTML layout.
    We want to filter output data according to our portal current user name
    When we try to use portal.wwctx_api.get_user inside of omni portlet select statement fallowing error occurs.
    Error in executing Query : [ORA-06510: PL/SQL: unhandled user-defined exception ORA-06512: at "PORTAL.WWCTX_SSO", line 1803 ORA-06510: PL/SQL: unhandled user-defined exception ORA-06512: at "PORTAL.WWCTX_SSO", line 1637 ORA-06502: PL/SQL: numeric or value error ORA-06512: at "PORTAL.WWCTX_SSO", line 1865 ORA-06512: at "PORTAL.WWCTX_API", line 183 ]
    Thanks a lot

    This is because the Omniportlet is actually operating within a different context--a separate database connection from the Portal connection. We have similar issues with Java portlets. You might try creating a public parameter on the portlet, then mapping that to the system variable USER (done on the Parameters tab of the page where you deploy it--if you don't see a parameters tab, you must enable Parameters and Events at the page group properties level). I haven't tested any of this, but it should get you going in the right direction.

  • How can I filter a Sharepoint 2007 libarry list based on current user login?

    Hi all.
    I would like to know how I can filter a SharePoint library list based on current user login.
    Suppose I have created the followings:
    1) A SharePoint form library containing bunch of uploaded InfoPath form data.
    2) The InfoPath form template contains a promoted text field called "TargetUser" to store user domain login (ex: DOMAIN\JOE) and every InfoPath form file in the library has a valid domain name stored in the "TargetUser" field.
    I have created a custom view for the form library and would like to filter this view so only items whose "TargetUser" field matches current user's login ID are displayed.
    I went to Edit View page to customize the view and tried to use the [Me] function but I got a "Filter value is not a valid text string" message instead when clicking OK. Apparently [Me] returns a Person/Group data type and the filter cannot compare its value
    to that of "TargetUser".
    I tried using text functions (ex: TEXT([Me],"") hoping to extract default string value from [Me]. The filter accepts the parameter without any error but the resulting fitlered list does not display any items at all.
    I have googled this subject for hours but I have not found any solution.
    It would be greatly appreciated if anyone can help me to create a functional filtered list.
    FYI, my SharePoint 2007 installation is just WSS 3.0 + Form Server. I do not have MOSS 2007 (so no MOSS 2007 web parts or web services).
    Thank you.
    Jason

    Here's what I usually do in order to accomplish this.  Ultimately you'll need to have 2 different fields.  There's the one you already have, with DOMAIN\username stored in it.  Then you'll need an additional field as a "person" column type. 
    Call it "TargetPerson" or something.
    Create a sharepoint designer workflow that runs each time an item is created or changed.  One action:
    Set FIELD to VALUE.
    The first FIELD is "TargetPerson", the VALUE is your "TargetUser" field. 
    Once this is done, then the person value is stored in the person field.  This is the field that you can filter by "TargetPerson" is equal to [Me]
    Laura Rogers, MCSE, MCTS
    SharePoint911: SharePoint Consulting
    Blog: http://www.sharepoint911.com/blogs/laura
    Twitter: WonderLaura

  • Is it possible to filter list view based on current user logged in

    Hi,
    Is it possible to filter the list view results based on the current user logged in. I have a scenario wherein i want to show only those list items to the user which contains his/her name under the column Approver (a list column).
    So if i login to the page, then only those requests should show up which has my name as the Approver, and so on.
    Is it possible please ?
    Thank you.

    Hi Prajk, you could use audience targeting for this. An alternative would be to create a view and add a filter so that "Approver" is equal to [Me]
    cameron rautmann

  • Auto numbering Column id and filter this lookup id in another list based on status="active"

    Hi,
    I am trying to autonumbeirng the column id with default column ID. But it is not reset if i delete the list item. Also i want this id in another column which have status="Active". How i will do this?
    Thanks in Advance.
    Roopesh

    Hi,
    According to your description, my understanding is that you want to reset the column ID when you delete the list item and then you want to filter the id in another list based on status.
    For resetting column id, there is no direct way to achieve it. I suggest you can save the list as a template and recreate the list. ID columns will always keep incrementing and will never be reused.
    Here is a similar thread about reset column ID for your reference:
    https://social.technet.microsoft.com/Forums/sharepoint/en-US/848a3d73-6273-45fa-806f-96312a4d71d1/is-there-anyway-to-reset-the-default-id-number-that-sharepoint-gives-to-an-item-back-to-1?forum=sharepointgeneralprevious
    For filtering look up field, here are some detailed demos for your reference:
    http://filteredlookup.codeplex.com/
    https://social.technet.microsoft.com/Forums/en-US/d23d6e9b-dc7b-4741-8746-dd4bf00b8110/how-to-filter-lookup-column-in-sharepoint-2010
    v
    Thanks
    Best Regards
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Jerry Guo
    TechNet Community Support

  • Powershell script to Scan Active Directory Attributes for Country and Department ,Then add to Sales Group then add to Distribution list based on Region

    Hey Scripting Guys,
    I have been in and out of Powershell last few years, not that great at it tbh !!! I'm looking for advice on how I can as in Title, Create a Powershell script to Scan Active Directory Attributes for Country and Department ,Then add to Group then add to Distribution
    list based on Region/Country
    I was thinking along the lines of get-aduser -LDAPFilter "(department=SALES France) and adding a where clause for country.
    Any help would be great.
    Dec

    So I have tried a few variations but get errors on both 
    get-aduser -LDAPFilter "(&(department=SALES)(c=us))" | Add-ADPrincipalGroupMembership -MemberOf "testgroup"
    get-aduser -LDAPFilter "(&(department=SALES)(c=fr))" | Add-ADGroupMember -identity "testgroup"
    Add-ADPrincipalGroupMembership : Object reference not set to an instance of an
    object.
    At line:1 char:86
    + get-aduser -LDAPFilter "(&(department=SALES)(c=fr))" | Add-ADPrincipalGroupMe
    mbership <<<< -MemberOf "testgroup"
    + CategoryInfo : NotSpecified: (:) [Add-ADPrincipalGroupMembershi
    p], NullReferenceException
    + FullyQualifiedErrorId : Object reference not set to an instance of an ob
    ject.,Microsoft.ActiveDirectory.Management.Commands.AddADPrincipalGroupMem
    bership

  • Current User Filter not available in the Add Web Parts list - Sharepoint 2007

    Hi everybody,
    I'm trying to build a copy (or auto-populate) function on a list.
    I did all the coding changes, now I need to add a web part to my list called Current User Filter.
    Problem is, the Current User Filter is not in the Web Part list at all!
    How can I add it ? I looked in the Central Admin Panel and did not see anything.
    Thanks in advance!

    What version of SharePoint are you using?  I think that this is s MOSS webpart, so if you're using the WSS version of the product, you're probably out of luck.
    Steven Andrews
    SharePoint Business Analyst: LiveNation Entertainment
    Blog: baron72.wordpress.com
    Twitter: Follow @backpackerd00d
    My Wiki Articles:
    CodePlex Corner Series
    Please remember to mark your question as "answered" if this solves (or helps) your problem.

  • Filter Project Server custom field based on current user?

    I've got a Project Server 2013 custom field, and I'd like to create a view that only shows me projects where the value in that custom field equals the current user. Simply put: I'm trying to find functionality similar to the [Me] filter in SharePoint.
    Apparently, simply using [Me] doesn't work. How can I fix this?

    I am trying to do something similar. were you able to find a solution to this? I am assuming no. 
    Parthiv Bhuta . Consultant

  • Filtration in the List based on "User!UserID"

    Goal:
    To make a filtration in the table list with support of "where" statement based on SSRS:s built-in function "User!UserID" in SSRS.
    Problem:
    I need apply the output value of the code
    REPLACE
    MID
    User!UserID,
    InStr(User!UserID,"\")+1,
    Len(User!UserID)
    in the dataset, inside of Where statement, but I retrieve error.
    I also tried to apply the sourcecode as a variable and use it in the dataset, but the query designer complain that the variable do not exist. I'm using MDX code
    What should I do?
    WHERE
    FILTER
    xxxxxxxx.xxxxxxxx.ALLMEMBERS AS c,
    c.Current.Name =
    REPLACE
    MID
    User!UserID,
    InStr(User!UserID,"\")+1,
    Len(User!UserID)

    Hi Sakura,
    Analysis Services data is Multidimensional Data. All Microsoft SQL Server Analysis Services dimensions are groups of attributes based on columns from tables or views in a data source view.
    The data structure is [Dimension].[Hierachy].&[FieldValue]. For example:
    WHERE ( [Geography].[Country].&[Canada]
    ). Also, we can use design mode to filter data. Please refer to the screenshot below:
    If there are any misunderstanding, please feel free to let me know.
    Regards,
    Alisa Tang
    Alisa Tang
    TechNet Community Support

  • How do I update items on a 2nd list based on data changes on the first list

    Hi everyone, let me start by saying I am still learning about Sharepoint - what it can or can't do etc. I am also not a developer by nature. So it may take me little while to understand. Thanks for your patience and help.
    I am currently working on Sharepoint 2007.
    I have a Booking form and an Inventory form.
    With the booking from I have a column where the user can select the inventory item to book e.g. BookedItem
    With the inventory form I have a Availability column. (i.e. It's a text column populated with either Yes or No)
    I've also got a view on the front page of my Sharepoint page showing users what is currently available for booking. This is just a filtered view of Inventory form. Basically it displays items where Availability = Yes.
    What I would like to do is have a workflow that automatically updates the Availability in the Inventory list when an item is booked in the Booking Form.
    E.g Item A is booked via the Booking Form. Item A's availability in the Inventory List should now the 'No'.
    Users should now no longer be able to see Item A as an available item on my Sharepoint page.
    I am struggle with linking the two lists and making the corresponding updates. I'd appreciate it someone could help me out.
    Thanks.

    Hi Anil
    Thanks for the reply. I've attempted the steps in the link as shown but if the issue I am getting is because I am running Sharepoint 2007 instead. The example that you've linked is based on Sharepoint 2010.
    Just to be clear I am following
    "3. Now add one action : "Set Variable"
        Variable Name : CarId & Type : Integer
        Assign with CurrentItem's CarName (which one is lookup column for Car Name)"
    I am unable to assign the new variable to the ItemName. Nor do I get the option of a lookup for integer like shown in the example link.

  • How to get the list of active devices in current wifi network?

    Hi All,
    I am going to a start a new Network based app. So please any one give me an idea on the below question.
    How to get the list of active devices in current wifi network?

    Nope I want the log-in user to retrieve its Group where he is belong. I have this following code
    strUsername = Request.getParameter("username").toLowerCase().trim()+"@dev.test.com.ph";
    strPassword = Request.getParameter("password").toLowerCase().trim();
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, INITCTX);
    env.put(Context.PROVIDER_URL, MY_HOST);
    env.put(Context.SECURITY_AUTHENTICATION, "simple");
    env.put(Context.SECURITY_PRINCIPAL,strUsername);
    env.put(Context.SECURITY_CREDENTIALS, strPassword);
    // enable tracing
    env.put("com.sun.naming.ldap.trace.ber", System.err);
    // Create the initial context
    DirContext initCtx = new InitialDirContext(env);
    // Get the target context
    DirContext targetCtx = (DirContext)initCtx.lookup("");
    SearchControls constraints = new SearchControls();
    constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
    // Perform the search on the target context
    NamingEnumeration enum = targetCtx.search("","(userPrincipalName="+strUsername+")",constraints);
    javax.naming.directory.Attributes attrs;
    NameClassPair item;
    String[] attrIds = new String[]{"MemberOf"};
    // For each answer found, get its "Groups" attribute
    // If relative, resolve it relative to the target context
    // If not relative, resolve it relative to the initial context
    while (enum.hasMore()) {
    item = (NameClassPair)enum.next();
    Out.println(item);
    attrs = targetCtx.getAttributes(item.getName(), attrIds);
    Out.println(attrs + "<br>");
         initCtx.close();
    It returns all this string :
    {memberof=memberOf: CN=CMCanadaRD,OU=Groups / Teams,DC=dev,DC=test,DC=com,DC=ph, CN=iMngrCanadaRW,OU=Groups / Teams,DC=dev,DC=test,DC=com,DC=ph, CN=Domain Users,CN=Users,DC=dev,DC=test,DC=com,DC=ph, CN=Backup Operators,CN=Builtin,DC=dev,DC=test,DC=com,DC=ph, CN=Administrators,CN=Builtin,DC=dev,DC=test,DC=com,DC=ph}
    How can i retrieve the Group named CMCanadaRW and CMCanadaRD on the Attribute?
    Thanks

  • Sharepoint Online: Find an Item box is not finding all items in a list based on keyword search

    I am using SharePoint Online.
    I have a standard SharePoint list with a "Name" field (single line of text) and a "Description" field (multiple lines of text).  The Find n Item search box is present as expected, and works very sporadically.  For example, I
    have an item with the word "white" in the Description field.  Searching for "white" doesn't find the item.  I have a number of items with the word "vending" in the Name field.  Searching for vending returns some
    of the items, but not all of them.  
    I have gone into the list settings (Advanced) and reindexed the list.
    Here are two screenshots that illustrate the issue.  The first is unfiltered. The second shows a filter on the word "vending".  Note that some are found and some are not.
    Filtered
    Any idea what's going on?  

    I am also experiencing an issue with the find. If not the same issue David is having, I suspect it is related, so I will describe it here.
    I created a list based on the Contacts content type and within a standard list view, entering values in the "Find an item" box will match content of some columns, but not others. The four columns that the find misses are Position(renamed from Job Title),
    Email Address, Mobile Phone, and Years Of Service (a Numeric column I added to the list). I too have re-indexed the list and retested after several hours.
    Full Name and Email Address are both native columns of the Contact content type and both are Single line of text. I am able to filter the list by finding partial matches on Full Name, but not Email Address.

Maybe you are looking for

  • Digital Publishing and Interactivity with digital magazine on my own server

    Hello... I am researching what would be the best plan of action for my project... need to design a digital magazine for the web that is interactive and has rich media like video, animations, etc. I am thinking of doing the following... design my anim

  • In need of help

    I am having trouble accessing a data file for my program to run. the code I have is this so far: // a good starting shell for the first real program import java.awt.*; import java.net.*; import java.io.*; import java.awt.event.*; import javax.swing.*

  • Can't reorder songs in some playlists

    I want to reorder the songs in one of my playlists. When I try to drag a song to a new location a blue line appears around the whole playlist and the black bar that usually tells you where the song will drop does not appear. This only happens in some

  • Sony nex 6 support?

    hello, i have a sony nex 6 camera. i would like to know if the latest photoshop of lightroom supports this camera and its RAW file - ARW? If not, what do you recommend i do? i want to avoid having to compress the images, if that would reduce quality.

  • Best Way to Configure Multi-boot System With GRUB/GRUB2

    Hello again, Sorry for posting so much, but I'm really enjoying Arch so far! I had been reading a lot about Cinnamon so I wanted to try it (without installing the dependencies on my Arch installation), so I decided to install Mint, that went fine, an