I want to add a `SELECT` field to a form, that lis...
# suitescript
d
I want to add a
SELECT
field to a form, that lists all the Saved Searches. Anyone know the proper
source
to set ?
s
-119
d
Magic. Thanks @Sandii
s
If you have chrome addon
Advanced Field Help
, when making a new field in the UI, the help displays the internal ids of all available options.
d
I'll look into that ... one more question. How to I set the defaultvalue of that select/dropdown
s
just
.defaultValue= searchId
on the end of the field definition. Or use
form.getField().defaultValue=
if creating the form and setting the value at different times
d
hmmm ... no dice. That's ok, I'll work on it
s
this is working for me
Copy code
var tempF = form.addField({
                id: 'custpage_test',
                type: serverWidget.FieldType.SELECT,
                label: 'Test',
                source: '-119'
            });
            log.debug('options', tempF.getSelectOptions())
            tempF.defaultValue = '-1102';
d
saved search might not be Public, I think the list only shows those
also if you don't want to install that addon, you can just run
jQuery('.ns-dropdown[data-name="selectrecordtype"]').data('options')
in the console when on page for adding new custom Fields, should give you the NetSuite options
👍 1