Skip to main content
Known Participant
Apr 3, 2026 3:44 AM UTC
Question

User filter-Records

I am creating a user filter,for completed by we have stored the value in userId ,while showing in record list using user function ,I need to sort the filter options.Is there anny possible way can someone help me

For the below example let's say,I want to sort the usernames in alphabetical order.

a!localVariables(
local!acctExecs: getdistinctusers(cons!ACCOUNT_OWNERS),
a!recordFilterList(
name: "Account Executives",
options: a!forEach(
items: local!acctExecs,
expression: a!recordFilterListOption(
id: fv!index,
name: user(fv!item, "firstName") & " " & user(fv!item, "lastName"),
filter: a!queryFilter(
field: recordType!Customer.fields.AccountOwner,
operator: "=",
value: fv!item
)
)
)
)
)

    13 replies

    shubhama926776
    Brainy
    Apr 3, 2026 6:04 AM UTC

    Can you try this

    a!localVariables(
      local!acctExecs: getdistinctusers(cons!ACCOUNT_OWNERS),
      local!mappedUsers: a!forEach(
        items: local!acctExecs,
        expression: a!map(
          username: fv!item,
          displayName: user(fv!item, "firstName") & " " & user(fv!item, "lastName")
        )
      ),
      local!sortedUsers: todatasubset(
        local!mappedUsers,
        a!pagingInfo(
          startIndex: 1,
          batchSize: -1,
          sort: a!sortInfo(field: "displayName", ascending: true)
        )
      ).data,
      a!recordFilterList(
        name: "Account Executives",
        options: a!forEach(
          items: local!sortedUsers,
          expression: a!recordFilterListOption(
            id: fv!index,
            name: fv!item.displayName,
            filter: a!queryFilter(
              field: recordType!Customer.fields.AccountOwner,
              operator: "=",
              value: fv!item.username
            )
          )
        )
      )
    )

    शुभम्
    Known Participant
    Apr 3, 2026 10:57 AM UTC

    This is not working distinct user function

    It says expression evaluation error at function user

    harshas2775
    Brainy
    Apr 3, 2026 12:47 PM UTC

    Can you share the error you are getting? 

    Happy to help. Even happier to optimize.
    Known Participant
    Apr 3, 2026 11:37 AM UTC

     [mention:a11f77a729fb4db2af76b09948583328:e9ed411860ed4f2ba0265705b8793d05] 

    Known Participant
    Apr 9, 2026 5:32 AM UTC

    Can someone help me with this issue[mention:9861aef97eb2483a8b76175d9eda1e37:e9ed411860ed4f2ba0265705b8793d05]