Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

UI Builder Filter Component Not Showing Dynamic Values from Data Resource

SwapnilJambhule
Tera Contributor

 

 

Hi everyone,

 

I’m trying to populate filter options dynamically in a Filter component within UI Builder. I’m using a Data Resource that returns a list of values based on the logged-in user, and the data resource itself is working correctly I can see the expected result in data resource.

However, when I try to bind that data to the Filter component, the filter does not display those dynamic values. It seems like the Filter component isn’t picking up or applying the values returned from the Data Resource.

 

I am returning the dynamic data using the transform data resource. The data I am returning through the data resource is something like this

[

 {"label" : "ABC"},

 {"label" : "DEF"}

]

Has anyone successfully used a Data Resource to drive dynamic options in a Filter component? If so, how did you configure it, or is there any known limitation or workaround for this?

 

Any help or suggestions would be really appreciated.

Thanks!

 

1 REPLY 1

ankitbanerj
Tera Expert

Hi @SwapnilJambhule,
can you please try this type of syntax in a data broker script.

// Define the transform function that takes an input object
function transform(input) {
    // Build the final query based on whether incident was found
    var finalQuery = incidentId ? 'active=true' : 'sys_idINnone';
    // Return the final encoded query string
    return finalQuery;
}

 Regards,
AnkitB
If this solution worked for you, kindly mark it as Accepted Solution and give it a Helpful rating to support the community.