How to dynamically set value on a default or user filter on Record Type?

Certified Senior Developer

Hi,

I'm trying to access a RecordType I've created in an interface.

To do this, I've created my Gridfield and added all the RecordType columns. I did the same with index.
Now, that the grid is well displayed, is there any way to set the value of default filters or user filters?

or enable/disable one of them please?

I find it hard to imagine that my RecordType grid can be filtered only by a manual user action... I hope not.

Any help would be greatly appreciated.

Regards

  Discussion posts and replies are publicly visible

Parents Reply Children
  • 0
    Certified Senior Developer
    in reply to Stefan Helzle

    Thank you Stefan, but once again... I need to do it programmatically... not from or inside the RecordType Interface.

    In your example, you set "Default value" = "One"
    but how to do, if I need to put  "Default value" = "Two" without touching the RecordType ?

  • 0
    Appian Employee
    in reply to cedric01

    It's only possible to define the default value for a user filter in the record type - it's not possible to define this on the fly when referencing the user filter in a grid. Granted, the default option in the record type can accept an expression, so you could create some more advanced logic if you'd like.

    I also can't quite tell based on the discussion above though: do you need to define a default value for the user filter or just apply a filter to the grid without the user being able to change it? If it's the latter, you can define a filter in the data source using the a!recordData() function like this:

    a!gridField(
      label: "Read-only Grid",
      labelPosition: "ABOVE",
      data: a!recordData(
        recordType: 'recordType!{ccd1a746-9707-4f92-b9d7-0d83c6ff7854}Customer',
        filters: a!queryLogicalExpression(
          operator: "AND",
          filters: {
            a!queryFilter(
              field: 'recordType!{ccd1a746-9707-4f92-b9d7-0d83c6ff7854}Customer.fields.{status}status',
              operator: "=",
              value: "Open"
            )
          },
          ignoreFiltersWithEmptyValues: true
        )
      ),
      columns: {...}
    )

  • 0
    Certified Senior Developer
    in reply to Peter Lewis

    Thanks a lot Peter, it is exactly what I was looking for.
    I'm sure this will help, as my grid has to be dynamically filtered from others sources (like another grid or specific values that can be dynamic)