Dynamic User FIlter

Certified Senior Developer

Hi all,

I am trying to create a user filter wherein the option labels will come dynamically from an expression rule. I am not quite sure how to achieve this. Does anyone know how to do this ? 

  Discussion posts and replies are publicly visible

  • +1
    Certified Senior Developer

    Hello ,

    You can create using the expression in the User Filters.

    Search and User Filters>New User Filter>Expression> use the a!recordFilterList() and create your list dynamically.

    If you are having your community instance, you can check the Acme Solutions Application.

    a!localVariables(
      local!vehicleMakes: a!queryRecordType(
        recordType: 'recordType!{5f29c334-b8fd-43d7-aaf3-a50d45b1e0da}AS Vehicle',
        fields: a!aggregationFields(
          groupings: {
            a!grouping(
              field: 'recordType!{5f29c334-b8fd-43d7-aaf3-a50d45b1e0da}AS Vehicle.fields.{011784c1-a547-4989-9af1-e6039f6b9d2a}vehicleMake',
              alias: "make"
            )
          },
          measures: {
            a!measure(
              field: 'recordType!{5f29c334-b8fd-43d7-aaf3-a50d45b1e0da}AS Vehicle.fields.{011784c1-a547-4989-9af1-e6039f6b9d2a}vehicleMake',
              function: "COUNT",
              alias: "count"
            )
          }
        ),
        pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 5000)
      ),
      a!recordFilterList(
        name: "Make",
        options: a!forEach(
          items: local!vehicleMakes.data,
          expression: a!recordFilterListOption(
            id: fv!index,
            name: fv!item.make,
            filter: a!queryFilter(
              field: 'recordType!{5f29c334-b8fd-43d7-aaf3-a50d45b1e0da}AS Vehicle.fields.{011784c1-a547-4989-9af1-e6039f6b9d2a}vehicleMake',
              operator: "=",
              value: fv!item.make
            ),
            dataCount: fv!item.count
          )
        )
      )
    )

    Please change accordingly.

    Hope this will help you.