How to dynamically set choice variable?

Akki1
Tera Contributor

Hi ,

I have a table called u_dynamic fields

And in the catalog I have a variable called Choose an Action and its a reference to the above table and one more variable called Types of services which is a choice field. Now in the above table there are many fields but let's take the one needed

1.Action Name

2.Services

Now the services contains comma separated values. Now I want if Action is chosen the Types of services variable dropdown is configured according to Services from the table which has values there.

1 REPLY 1

Anubhav24
Mega Sage
Mega Sage

Hi @Akki1 ,

You need to write an onChange Client Script of the field "Action" then in this script you need to make a backend call using GlideAjax to a script include and in this script include query your table "u_dynamic" by building the query with the value received from client script and then build an array of values in your script include and return this array.

Now once you have received the array , you can add values to your choice list using g_form.addOptions , you need to loop through the array and add the values.