Cascading Drop down filter by User Group

Forums Cascading dropdowns Cascading Drop down filter by User Group

Viewing 2 reply threads
  • Author
    Posts
    • #31860
      Paul Heffner
      Participant

      Good Day!

      I was trying to figure out a way to keep my cascading drop downs exactly as they are now with the exception that I only want a few of the options available to only a certain SharePoint Group.

      I tried to do a CAML query but even using one simple field it times out (listed below)

      <where><eq><fieldref name=’Active’ /><Value Type=’Text’>Yes</value></eq></where>

      I was going to work on the membership part after getting this simple one to work but it times out. Is my syntax wrong and is it possible to do what I am looking for?

    • #31862
      Alexander Bautz
      Keymaster

      The CAML syntax is case sensitive – try it like this:

      <Where><Eq><FieldRef Name='Active' /><Value Type='Text'>Yes</Value></Eq></Where>

      Please note that if your “Active” field is yes/no checkbox (boolean) you must do it like this:

      <Where><Eq><FieldRef Name='Active' /><Value Type='Boolean'>1</Value></Eq></Where>

      You can use the Membership element like described here: https://docs.microsoft.com/en-us/sharepoint/dev/schema/membership-element-query

      Alexander

    • #31864
      Paul Heffner
      Participant

      Thank you for the fast reply. I have the active part working but still having trouble with the membership

      
      
      <Where><And>
      
      <Eq><FieldRef Name='Active' /><Value Type='Text'>Yes</Value></Eq>
      
      <Eq><Membership Type=\"CurrentUserGroups\ "><Value Type='Text'>MIS Reporting Owners</Value></Membership></Eq>
      
      </And></Where>

      This is assuming the group name is MIS Reporting Owners

      • #31872
        Alexander Bautz
        Keymaster

        This is unfortunately not how the Membership check works in CAML. It will only check that you are a member of the group selected in the “Person or Group” field in each list item and not a general check to see if you are member of the group specified in a Value tag.

        This means that if you use a query like this:

        <Where>
        <And>
        <Eq><FieldRef Name='Active' /><Value Type='Text'>Yes</Value></Eq>
        <Eq><Membership Type='CurrentUserGroups'><FieldRef Name='AssignedTo' /></Membership></Eq>
        </And>
        </Where>

        You would get back all items where Active = Yes and where the AssignedTo Person or Group field had a SharePoint group where you are member selected.

        Depending on what you are trying to do, you can use custom js to check if the logged in user is in a specified group and then invoke different cascading dropdown functions (by building the function call in custom js and not use the cascading dropdown tab in DFFS) – where you use a different query to get the options.

        Alexander

Viewing 2 reply threads
  • You must be logged in to reply to this topic.