Dynamic population of an existing combobox

I’m new to the Solution Model paradigm - I’m trying to use the Solution Model to dynamically fill an existing combobox on an existing form - so far its not working.

My existing form is called ‘seis_set_query’, the existing combobox field is called ‘fv_current_search’
In this simple example I just want the value ‘Test1’ to show up in the combobox…

  var lv_valuelist = solutionModel.newValueList('user_queries', SM_VALUELIST.CUSTOM_VALUES);
  lv_valuelist.separator = '|';
  lv_valuelist.customValues = 'Test1|bla';

  var lv_form = solutionModel.getForm('seis_set_query');
  var lv_field = lv_form.getField('fv_current_search');
  lv_field.valuelist = lv_valuelist;

The code executes without error but there is no value in the combobox.
Can anyone spot the problem ?

Thanks in advance
Mark

------UPDATE------
I got this to work if I ran this code BEFORE the form was loaded/shown for the first time - it seems that it doesn’t work if the form is already loaded/shown.
The code I used is slightly different from what was originally posted…

  var lv_valuelist = solutionModel.newValueList('user_queries', SM_VALUELIST.CUSTOM_VALUES);
  lv_valuelist.separator = ' ';
  lv_valuelist.customValues = 'Test1|bla1\r\nTest2|bla2';
  var lv_form = solutionModel.getForm('seis_set_query');
  var lv_field = lv_form.getField('fv_current_search');
  lv_field.valuelist = solutionModel.getValueList('user_queries');

Hi Mark,

you already got your answer: creating objects /changing properties using the solutionModel have to be done before a certain form is loaded.

Reading properties isn’t a problem at all, this can be done at anytime.

Hi Mark,

You shouldn’t have to use the solution model for this.
You can pre create an empty value list and use the application node’s setValueListItems() method to change the items in the value list.

If for some reason you do need to change the field’s value list (i.e. between two value lists) then you would need the solution model.
You’ll have to unload the form using the history.remove() method before you show it. This will cause the changes to be in effect.

Hope this helps,
Sean

I took your advice and the population of my combobox works just fine, thanks Sean!

Cheers
Mark