Adding a value dynamically to an enum form field

Using the inline script within the modeller. I can set a variable and apply that variable to a textfield. For example;

var myval = “123456”;
execution.setVariable(‘myfield’, myval );

Within a new task, set the ${myfield} as a Default Value. So adding values to textfields no problem.

Using the same logic, I want to apply an enum list but not having any joy.

var list = [{
“id” : “id1”,
“value” : “Sharky”
},{
“id” : “id2”,
“value” : “George”
}]

var listObj = S(JSON.stringify(list));
execution.setVariable(“mylist”, listObj )

Attempting to use ${mylist} doesnt seem to work.

Also trying things like this also fails

var myOptions = {
val1 : ‘text1’,
val2 : ‘text2’
};
var mySelect = $(‘#mySelect’);
$.each(myOptions, function(val, text) {
mySelect.append(
$(‘’).val(val).html(text)
);
});