The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Create a User Script That Includes Bind Data Information for Filtering List Data UI Builder

davmz
Tera Contributor

Hi I am wondering if it is possible to create a USER SCRIPT that includes bind data information OR BIND DATA that includes user script information to filter list component data in UI Builder. 


Context:
I have 2 list components that list out Incidents that have different features and want to combine into one.

The first list has a bind data fixed filter through a filter component based on the state of the incident. I have followed the documentation so this is how it's configured: *I am also setting up a date filter but I am just starting out with state*
https://developer.servicenow.com/dev.do#!/reference/next-experience/vancouver/now-components/sn-comp...

davmz_0-1705511951785.png

This is the composition JSON data of the list component.

 

 

"fixedQuery": {
    "binding": {
        "address": [
            "encodedIncidentQueries",
            "incident"
        ]
    },
    "type": "STATE_BINDING"
},

 

 


The second list has a user script fixed filter to only grab incidents based on the cmdb_ci. (i have a URL parameter that grabs the id and is being stored as a client state variable)

 

 

/**
 *  {params} params
 *  {api} params.api
 *  {TransformApiHelpers} params.helpers
 */
function evaluateProperty({
    api,
    helpers
}) {
    return {
        fixedQuery: `cmdb_ci=${client state variable}`,
    };
}

 

 


Can I combine these into one user script as I am needing to filter the incidents based on these requirements:

 

- filter incidents based on state through a filter component

- filter incidents based on the cmdb_ci URL parameter

If not possible is there a different approach I should take.

Thanks in advance.

0 REPLIES 0