Skip to main content
February 2, 2024
Question

Sort appian group members for dropdown

  • February 2, 2024
  • 7 replies
  • 0 views

Hi , How can I sort appian group members and bind to dropdown.

    7 replies

    stefanhelzle0001
    February 2, 2024

    Where do you get this list from? The groupMembers() function can already sort your items.

    harshitb6843
    February 2, 2024

    When you provide paging info for groupMembers, you can additionally pass these two fields in the sortInfo and control the sorting. 

    a!groupMembers(
      group: cons!GROUP,
      pagingInfo: a!pagingInfo(
        startIndex: 1,
        batchSize: 100,
        sort: {
          a!sortInfo(
          field: "groupName",
          ascending: true
        ),
        a!sortInfo(
          field: "username",
          ascending: true
        )
        }
      )
    ).data

    prakhars0731
    February 2, 2024

    you can use groupMembers() function 

    a!groupMembers() Function (appian.com)

    konduruc733182
    February 2, 2024

    If you have a particular group then you can use the a!groupMembers() function. If its the users from the environment, you can use functions from plugins and create your dropDown. Using what Harshit has given as a sample code for a group Specific requirement.

    getAllUsers() is a function to get all the users from the environment. You can get it here People Functions Plug-in


    a!localVariables(
      local!users: getallusers(1, - 1),
      local!choices: a!forEach(
        items: local!users,
        expression: concat(
          user(fv!item, "firstName"),
          " ",
          user(fv!item, "lastName")
        ),
        
      ),
      a!dropdownField(
        choiceLabels: local!choices,
        choiceValues: local!users,
        placeholder: "Select User"
      )
    )



    rupaa0642Author
    February 3, 2024

    Thank you all for your replies.

    This i need to add to record filter list. How can do that.

    harshitb6843
    February 3, 2024

    You can just copy and paste this into your filter list, run a loop over it, and add the query filter.

    a!recordFilterList(
      name: "Members",
      options: a!forEach(
        items: a!groupMembers(
          group: cons!GROUP,
          pagingInfo: a!pagingInfo(
            startIndex: 1,
            batchSize: 100,
            sort: {
              a!sortInfo(
                field: "groupName",
                ascending: true
              ),
              a!sortInfo(
                field: "username",
                ascending: true
              )
            }
          )
        ).data,
        expression: a!recordFilterListOption(
          id: fv!index,
          name: fv!item,
          filter: a!queryFilter(
            field: recordType!Record.fields.fieldname,
            operator: "=",
            value: fv!item
          )
        )
      )
    )