首页 > 解决方案 > SuiteScript 2.0 Suitelet Sublist with line-specific "Select" options

问题描述

I currently have a nice suitelet popup as a PDF Report selection. Everything so far works nicely.

However, some of the available PDF reports require individual options to be passed. ie. a date, or a class selction specific to ONLY 1 of the forms.

Currently I have created the sublist:

var documentList = form.addSublist({
    id: 'documentlist',
    label: 'Documents Available'+ (data.job ? ' for Job Number: '+data.job : ''),
    type: serverWidget.SublistType.LIST
})
documentList.addField({ id: 'mark',             type: 'CHECKBOX',       label: 'Print'});
documentList.addField({ id: 'config',           type: 'SELECT',         label: 'Form', source: 'customrecord_advancedformconfig' }).updateDisplayType({displayType : 'INLINE'});
documentList.addField({ id: 'vardate',          type: 'CHECKBOX',       label: 'Variation Dates' }).updateDisplayType({displayType : 'INLINE'});
documentList.addField({ id: 'document',         type: 'TEXT',           label: 'Document',  }).updateDisplayType({displayType : 'HIDDEN'});
documentList.addField({ id: 'primaryrecord',    type: 'TEXT',           label: 'Main Record'}).updateDisplayType({displayType : 'INLINE'});
documentList.addField({ id: 'storeincabinet',   type: 'CHECKBOX',       label: 'Save to Cabinet'}).updateDisplayType({displayType : 'INLINE'});
documentList.addField({ id: 'filename',         type: 'TEXT',           label: 'File Name to be Generated'}).updateDisplayType({displayType : 'NORMAL'});
var pdfOptions = documentList.addField({ id: 'formoption',  type: 'SELECT', label: 'Option' }).updateDisplayType({displayType : 'NORMAL'});

The last line is the sublist field for the form options.

Lets assume the first line requires a couple of date options, while the second line requires a couple of size or colour options.

As there is only a "field" action to pdfOptions.addSelectOption(...) this adds options to ALL occurences of the field.

Is there a method for each LINE of the sublist, to set options for just a single line??

There is no pdfOptions.addSublistSelectOption(...) so I'm going to guess the answer is not, but thought I would ask anyway.

To illustrate, see below image... Only the last line should have a date dropdown.

enter image description here

标签: netsuitesuitescript2.0

解决方案


The way I've accomplished having different select options for different lines is using a client script with the lineInit entry point that cleared out the existing options and added relevant ones for that line.

However you would need to change the sublist type from LIST to EDITOR or INLINEEDITOR for this to work, which probably wouldn't work well in your use case.


推荐阅读