Create a User Script That Includes Bind Data Information for Filtering List Data UI Builder
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2024 09:26 AM - edited 01-17-2024 09:41 AM
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...
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.