hi, I am creating a suitelet form, where upon ente...
# suitescript
k
hi, I am creating a suitelet form, where upon entering sales order id, I want user to select the items associated with the sales order in a dropdown field in the sublist. how can I define the dropdown field in the sublist to refer to a list of items associated to the sales order? In other words, how can I
source
the list in a field added in the sublist, using a saved search that pulls the values?
b
most straighforward will be Field.insertSelectOption(options)
no source for you
k
so I have this so far, how does the above work here:
Copy code
var form = serverWidget.createForm({
                     title: 'Results'
                 });

                 var sublist = form.addSublist({
                     id: 'sublist',
                     type: serverWidget.SublistType.INLINEEDITOR, 
                     label: 'Item List'
                 });

                 var item = sublist.addField({
                     id: 'item',
                     label: 'Item',
                     type: serverWidget.FieldType.SELECT
                 });
b
not sure of you can do it for a sublist field
but you would do it in client script
you might be able to use Field.addSelectOption(options) serverside if you can get the sales order as a parameter to the suitelet
you might get some weirdness with the select options though since select fields can act strangely in suitelets
k
Nice! looks like
addSelectOption
works in my case 🙂 thank you!