Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Dynamic filter on a Data Table Widget

Ricardo Natalin
Tera Contributor

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.

print 1.png

Is it possible to make a dynamic filter work this way? If not, is there another way?

 

Thank you.

 

1 REPLY 1

-O-
Kilo Patron

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&colon; 'sys_idIN' + new filtroPorUorUsarioLogado().getRequisicoes().join(',');

Though all that only if the widget in question is so built as to interpret javascript&colon; 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.