Sublist.insertField(options)
Method Description |
Inserts a field in front of another field. |
Returns |
void |
Supported Script Types |
Suitelets User event scripts -beforeLoad entry point For more information, see SuiteScript 2.x Script Types. |
Governance |
None |
Module |
|
Since |
2024.2 |
Parameters
The options parameter is a JavaScript object.
insertField is intended for custom fields created within beforeLoad. Moving fields between different tabs is not supported.
Parameter |
Type |
Required / Optional |
Description |
Since |
---|---|---|---|---|
|
required |
The Field object to insert. |
2024.2 |
|
|
boolean |
optional |
Used to specify whether the field is inserted before or after the next field (options.nextfield). |
2024.2 |
|
string |
required |
The internal ID name of the field you are inserting a field in front of. |
2024.2 |
Syntax
The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/ui/serverWidget Module Script Samples.
//Add additional code
...
var form = serverWidget.createForm({
title : 'Simple Form'
});
var sublist = form.getSublist({
id : 'custsublist_custom'
});
var field1 = sublist.addField({
id : 'custpage_text',
type : serverWidget.FieldType.TEXT,
label : 'Text 1'
});
var field2 = sublist.addField({
id : 'custpage_text2',
type : serverWidget.FieldType.TEXT,
label : 'Text 2'
});
var field3 = sublist.addField({
id : 'custpage_text3',
type : serverWidget.FieldType.TEXT,
label : 'Text 3'
});
sublist.insertField({
field : field3,
isBefore: true,
nextfield : 'custpage_text'
});
...
//Add additional code