How to add saved search result to select field in suitelet as options?

I have created suitelet to add select type field. I have created field, but now I want to add search result as options to the select field. How its can be done? Please Help!

 

  var filtersFieldGroup = form.addFieldGroup({
            id : ‘custpage_filter’,
            label : ‘Select Filters….’
        });
        var subsidiaryField=form.addField({
            id: ‘custpage_subsidiary’,
            type: serverWidget.FieldType.SELECT,
            label: ‘subsidiary’,
            container: ‘custpage_filter’
        });
Beginner Asked on February 22, 2023 in SuiteScript.
Add Comment
3 Answer(s)

perform your search then, iterating your results, for each result:


subsidiaryField.addSelectOptions({value:<THE_RECORD_INTERNALID>,text:<THE_TEXT_VALUE>});

Beginner Answered on February 22, 2023.

sorry, typo addSelectOption not the plural: addSelectOptions

on February 22, 2023.

You can refer below code,

var formField = form.addField({id: ‘custpage_saved_searches’, type: ‘select’, label: ‘List of Transaction ‘});

var objSavedSearches = getSavedSearches();

for (var i = 0; i < objSavedSearches.length; i++) {

if (i == 0)

formField.addSelectOption({ value: “”, text: “”, });

formField.addSelectOption({ value: objSavedSearches[i].id, text: objSavedSearches[i].title, }); }

on February 22, 2023.

thanks ! can we add border and collapse & expand option to field group? like, for example like sales order list page filter ?

 

on February 23, 2023.
Add Comment

Here’s an article I wrote that shows the full code. Hope it helps:

Beginner Answered on February 22, 2023.
Add Comment

Jai’s answer is pretty good.

Thanks

STREAMS Solutions

NetSuite Consultants

Rookie Answered on February 28, 2023.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Become a Sponsor   Become a Sponsor