Dynamic filter on a Data Table Widget
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2023 01:28 PM
Hello, all.
I have a data table widget and I need a dynamic filter to be applied.
I have created the script include and I am trying to use it in the filter field of the widget, but it is being ignored.
When I call the script include on background, it returns an array of IDs (not sys_id).
REQU0001051,REQU0001052
I have tried changing it so the return is the sys_id and it didn´t work as well. I´m on an scoped application.
Here´s a picture from the widget. I have tried to write the entire name but it didn´t work too.
Is it possible to make a dynamic filter work this way? If not, is there another way?
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2023 01:46 PM
That is not a dynamic filter.
Dynamic filters are defined by accessing the Dynamic Filter Options application and creating a new record there.
That said, reference qualifiers need to return an encoded query.
A list of sys_ids is not an encoded query.
So you should either return from method getRequisicoes() something like
return 'sys_idIN' + <array of sys_ids>.join(',');
or you should re-write the content of the field as
javascript: 'sys_idIN' + new filtroPorUorUsarioLogado().getRequisicoes().join(',');
Though all that only if the widget in question is so built as to interpret javascript: tokens.
Otherwise you need to create real dynamic queries and your query will than look like
caller_idDYNAMIC<sys_id of the dynamic query you would create>
Other than that, for f..k sake either make it pegarRequisicoes or getRequests, but not getRequisicoes.