michoel
03/17/2021, 12:47 AMfield.defaultValue = field.getSelectOptions().map((option) => option.value)
, but as soon as I call field.getSelectOptions
setting a default value stops working. Workaround is to create a second hidden field and get the options from that field to set on the displayed field netsuitestalbert
03/17/2021, 1:30 PMdefaultValue
is supposed to be but I presume a single value? The code you show would assign an array to defaultValue
jen
03/17/2021, 3:11 PMmichoel
03/17/2021, 10:02 PMstring|string[]
. Passing an array of strings works, but not after calling field.getSelectOptions()
This works:
const field = form.addField({
type: serverWidget.FieldType.MULTISELECT,
id: "custpage_multiselect_field",
label: "Test Field",
source: "custlist_my_custom_list",
});
field.defaultValue = ["1", "2", "3"];
This does not work:
const field = form.addField({
type: serverWidget.FieldType.MULTISELECT,
id: "custpage_multiselect_field",
label: "Test Field",
source: "custlist_my_custom_list",
});
field.getSelectOptions();
field.defaultValue = ["1", "2", "3"];
stalbert
03/17/2021, 10:06 PMmichoel
03/17/2021, 10:09 PMstalbert
03/17/2021, 10:28 PMstalbert
03/17/2021, 10:28 PM