User filter based on multiple fields

Hi,

I'm trying to create a user filter in a record that filters a combination of 2 fields. I've tried to use a!queryLogicalExpression() inside a!recordFilterListOption() for the filter and didn't work.

Is there any other way to do this? My other option is to create an interface with this filter but i think it would be better to have it as a user filter in the record.

Thanks,

Ignacio

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    One possible way you could do it is to create a local variable of partially filtered users.  Have that update whenever the first filter is applied.  Then, create another local variable of fully filtered users that works by applying the second filter to the partially filtered list local variable.  It would be updated when either the second filter changes, or the users in the first local variable change.

  • 0
    Certified Senior Developer
    in reply to Ignacio Arriagada

    hello  did you get solution for this issue? I am also looking for the solution. We are using 22.4 Version. Please let me know how you resolved this issue with default user filters and without using customize filters.

  • 0
    Certified Associate Developer
    in reply to shantipriyac

    You can create a custom record field and provide a user filter on top of that field. 

    If you share exact requirements, members can provide proper suggestions/inputs.

  • 0
    Certified Senior Developer
    in reply to shantipriyac

    What is your exact requirement, please elaborate. You will have to create separate filters for individual fields is what I am aware of. if it is a combination create a custom record field and a filter on it.

  • 0
    Certified Associate Developer
    in reply to shantipriyac

    With the help of userFilters you cannot meet the requirement. As of now it is not possible to configure an user filter by combination of two fields. You can configure a filter in the interface by using dropDown or textField component. Here is an example. 

    Now you can configure the filter with the help of dropDown component or text field. Here I have configured with dropdown.
    
    Expression Rule:GT_firstName
    
    a!queryRecordType(
      recordType: 'recordType!GT CustomerDetails',
      filters: a!queryLogicalExpression(
        operator: "OR",
        filters: {
          a!queryFilter(
            field: 'recordType!GT CustomerDetails.fields.firstName',
            operator: "=",
            value: ri!firstName,
            applyWhen: a!isNotNullOrEmpty(ri!firstName)
          ),
          a!queryFilter(
            field: 'recordType!GT CustomerDetails.fields.lastName',
            operator: "=",
            value: ri!lastName,
            applyWhen: a!isNotNullOrEmpty(ri!lastName)
          )
        }
      ),
      pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 500)
    ).data
    
    ---------------------------------------------------------------------------------------
    Interface Portion:
    
    a!localVariables(
      local!save,
      local!name: rule!GT_firstName(
        firstName: ri!firstName,
        lastName: ri!lastName
      ),
      {
        a!dropdownField(
          choiceLabels: cons!GT_USER_NAME,
          choiceValues: cons!GT_USER_NAME,
          label: "Name",
          placeholder: "Search here by name",
          value: local!save,
          saveInto: {
            local!save,
            a!save(ri!firstName, local!save),
            a!save(ri!lastName, local!save)
          }
        ),
        a!gridField(
          label: "",
          labelPosition: "ABOVE",
          data: local!name,
          columns: {
            a!gridColumn(
              label: "First Name",
              sortField: local!name['recordType!GT CustomerDetails.fields.firstName'],
              value: fv!row['recordType!GT CustomerDetails.fields.firstName']
            ),
            a!gridColumn(
              label: "Last Name",
              sortField: local!name['recordType!GT CustomerDetails.fields.lastName'],
              value: fv!row['recordType!GT CustomerDetails.fields.lastName']
            )
          },
          pageSize: 16
        )
      }
    )

Reply
  • 0
    Certified Associate Developer
    in reply to shantipriyac

    With the help of userFilters you cannot meet the requirement. As of now it is not possible to configure an user filter by combination of two fields. You can configure a filter in the interface by using dropDown or textField component. Here is an example. 

    Now you can configure the filter with the help of dropDown component or text field. Here I have configured with dropdown.
    
    Expression Rule:GT_firstName
    
    a!queryRecordType(
      recordType: 'recordType!GT CustomerDetails',
      filters: a!queryLogicalExpression(
        operator: "OR",
        filters: {
          a!queryFilter(
            field: 'recordType!GT CustomerDetails.fields.firstName',
            operator: "=",
            value: ri!firstName,
            applyWhen: a!isNotNullOrEmpty(ri!firstName)
          ),
          a!queryFilter(
            field: 'recordType!GT CustomerDetails.fields.lastName',
            operator: "=",
            value: ri!lastName,
            applyWhen: a!isNotNullOrEmpty(ri!lastName)
          )
        }
      ),
      pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 500)
    ).data
    
    ---------------------------------------------------------------------------------------
    Interface Portion:
    
    a!localVariables(
      local!save,
      local!name: rule!GT_firstName(
        firstName: ri!firstName,
        lastName: ri!lastName
      ),
      {
        a!dropdownField(
          choiceLabels: cons!GT_USER_NAME,
          choiceValues: cons!GT_USER_NAME,
          label: "Name",
          placeholder: "Search here by name",
          value: local!save,
          saveInto: {
            local!save,
            a!save(ri!firstName, local!save),
            a!save(ri!lastName, local!save)
          }
        ),
        a!gridField(
          label: "",
          labelPosition: "ABOVE",
          data: local!name,
          columns: {
            a!gridColumn(
              label: "First Name",
              sortField: local!name['recordType!GT CustomerDetails.fields.firstName'],
              value: fv!row['recordType!GT CustomerDetails.fields.firstName']
            ),
            a!gridColumn(
              label: "Last Name",
              sortField: local!name['recordType!GT CustomerDetails.fields.lastName'],
              value: fv!row['recordType!GT CustomerDetails.fields.lastName']
            )
          },
          pageSize: 16
        )
      }
    )

Children
No Data