Set default value on Dropdown component in UI Builder

Sarah_P
Tera Expert

Hello

I want to set a the value of a Dopdown component in UI Builder dynamically from a Client Script. 

How should I proceed ?

1 ACCEPTED SOLUTION

Diogo Ramos
Giga Sage

For those who still have the question, to se the default value you need to use the id that corresponds to the list items element id for example with the default data:

DiogoRamos_0-1727852890013.png


This will set the dropdown with L3 as the default value, keep in mid this default selection does not trigger the event mapping (Dropdown selected items set). 

 



View solution in original post

4 REPLIES 4

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Sarah_P 

 

What is exact use case you have.

 

https://www.servicenow.com/community/developer-forum/how-to-set-default-value-on-ui-page-dropdown/m-...

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

I am working on a modal to create an incident from a Custom Case Record Page.

 

On this model I need to create a Incident Creation Form modal with different input fields which should be autopopulated with the origin case record. One of them is a Dropdown (for Priority field) and it has to be auto populated when the modal opens. 

The Case details are fetched from a Data Source when the modal opens.

I want the dropdown to display the value fetched from the Data Source on FETCH_SUCCEED.

Diogo Ramos
Giga Sage

For those who still have the question, to se the default value you need to use the id that corresponds to the list items element id for example with the default data:

DiogoRamos_0-1727852890013.png


This will set the dropdown with L3 as the default value, keep in mid this default selection does not trigger the event mapping (Dropdown selected items set). 

 



Thank you ! That was the solution I went along with 🙂