How can I populate the choices of a field with a script?

Ulrich Matthew
Tera Contributor

I have a field "country" that is a choice, but I don't want to enter all the countries by hand , is there a way to accomplish this?

 

thanks in advance

1 ACCEPTED SOLUTION

Yousaf
Giga Sage

Hi Ulrich,

Why dont you make it a reference field to the core_country table.

I think it will be easy and no scripting needed plus if You want to add all countries how long you want you choices to go.

So i think reference field will be suitable for you.

 

find_real_file.png

 

find_real_file.png

 

find_real_file.png


Mark Correct or helpful if it helps.


***Mark Correct or Helpful if it helps.***

View solution in original post

3 REPLIES 3

Yousaf
Giga Sage

Hi Ulrich,

Why dont you make it a reference field to the core_country table.

I think it will be easy and no scripting needed plus if You want to add all countries how long you want you choices to go.

So i think reference field will be suitable for you.

 

find_real_file.png

 

find_real_file.png

 

find_real_file.png


Mark Correct or helpful if it helps.


***Mark Correct or Helpful if it helps.***

Unfortunately, there are records ill migrate to this new table with the value united_states which is different from the value inside core_country.

Ok I think this will help but you will need to modify the script a little.


Script Include choices


***Mark Correct or Helpful if it helps.***