List component: change table dynamically

Luca Armienti1
Tera Expert

Hi developers,

 

I have the need to use a List component, but with dynamic table and filter, depending on what it's selected from a dropdown component. 

 

I can change the filter easily, but trying to change the table dynamically gives me this error:

 

fabrizio95360_3-1698067364896.png

The error is: "Exception encountered processing path: /GlideListLayout_Query/getListLayout - Invalid table name [task]"

 

This is how i'm trying to make the list table dynamic, pretty standard:

 

fabrizio95360_0-1698066928228.png

 

filter is a client state changed by the dropdown component:

 

fabrizio95360_2-1698067267649.png

fabrizio95360_1-1698067228162.png

I can assure you that the dropdown components gives the right table name: incident, task, core_country, etc. It's something about changing the table that breaks the List component. Can it be solved / is there a workaround?

 

Thanks,

Luca

 

2 REPLIES 2

Brad Tilton
ServiceNow Employee
ServiceNow Employee

I did some testing with this and everything worked for me when binding a client state parameter to the table property on the list component and then changing the value of the CSP with a button from incident to sys_user.

The only way I was able to make it throw the error was when I passed it a string that wasn't a valid table name.

How are you setting the table name from the dropdown in the client state parameter? I would look a little more closely into that and log out the value you're setting.

Hi Brad,

 

Indeed the problem was about the dropdown. The dropdown components return a json with a property value: ["VALUE"], like: ["task"], or ["incident"]. So payload.value returned a value with brackets. I had to remove the brackets with a script.

 

Thanks,

Luca