Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Update UI Page content based on Choice list selection

patbishop
Mega Guru

I hope I'm asking a simple question that is easy to answer.

I am making a dashboard of table data in a UI Page. At the very top of the page there will be a dynamic choice list. Based on it's selection, I will need to update all of the pages data.

The Choice List value contains the sys_id. I thought that I could just call an onChange event and update the GlideRecord to re-pull the data, but I cannot seem to figure this out.

Currently, the data is just being displayed from the Glide Record in variables. The page is currently not a "form."

Any suggestions?

Note: I know enough about Jelly Scripting to be dangerous.

3 REPLIES 3

TrevorK
Kilo Sage

I'm not sure if I am understanding what you want - you have a custom UI page and it contains a field that you want the user to change, and when the user changes that field, something on the UI page changes?



I am sure there are many ways to handle this, however here it snapshot of what we do in one of ours. The summary is:


- We have a dropdown box (line 19) that contains a bunch of values we extract out of ServiceNow. When the user selects a value, the onchange for that select box is called, in this case it calls the function Edit_QM. Edit_QM takes in the value from the select box and does a lookup in ServiceNow based on it, putting the text into a field on the form.


find_real_file.png


find_real_file.png



Does this point you in the right direction or is it stuff you already know? If so, let me know what the next step is and I can (or I am sure someone else can) give you a hand. It's just without this basic step of getting a UI Page to function with the onchange, the rest is pretty pointless.


I ended up writing the the sys_id of their selection into a temp table and then refreshing the page, then querying to get the stored sys_id. I'm sure it's not the most efficient way, but until the time crunch I was under, it worked.   I will certainly check out your example!


Michael Ritchie
ServiceNow Employee
ServiceNow Employee

Not sure I am following your requirement but it sounds like you want a dashboard with reports based on a selection. I posted something on Share that may solve your requirement:


ServiceNow Share