The CreatorCon Call for Content is officially open! Get started here.

How to set default value on a filter in UI Builder

Dotychczas
Mega Guru

Hello Everyone,

I am working on a problem in UI Builder where I need to set a default value for a filter on a page using 'sys_id'. I'm not sure about the right format for this data. I tried many ways, but none seem to work. Also, this information isn't in the documentation.

I don't want to hardcode the value because my use case is different. Also, when I try using an object, the filter count increases, but it just keeps loading and doesn't work. Can anyone help me with the correct format for the data?

Dotychczas_0-1704798966131.png

 

5 REPLIES 5

User5416
Tera Contributor

You can use the format below to set up the Default value. Below is an example of a Default value with a data source as the User table:

 

function evaluateProperty({
    api,
    helpers
}) {
    return [{
        "available": true,
        "empty": false,
        "id": "62826bf03710200044e0bfc8bcbe5df1",
        "label": "Abel Tuter",
        "unknown": false
    }];
}
 
Note: The Filter type is Single Select.