State parameter modified by Client Script

mmorski
Tera Contributor

Hi,
I need to introduce in UI Builder functionality like this:
List Selector when selected/deselected can add "filter" and Pill selected/deselected can add "filter". I need to introduce state parameter "activeFilters" which will keep information about active filters. If user add new filter by clicking in list selector the corresponding Pill needs to be selected. So I need full synchronization between those 2 UI components based on state parameter. 
I think I can handle this by User Script but I don't know how can I get/set value to state parameter in User Script. What do You think is this possible to solve? 

1 REPLY 1

Brad Tilton
ServiceNow Employee
ServiceNow Employee

This sounds fairly complex, but you can set the state using the following in a page/client script: 

api.setState('stateVariableName', 'stateVariableValue');

 and read the state using the following:

api.state.stateVariableName