-
Notifications
You must be signed in to change notification settings - Fork 8
/
field.js
541 lines (500 loc) · 17.1 KB
/
field.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
/**
* SuiteScript Field APIs
*
* The SuiteScript API includes several Field APIs you can use to set and get values for built-in NetSuite standard
* fields, as well as for custom fields.
*
* Standard fields are those that come with NetSuite.
*
* Custom fields are those that have been created by NetSuite users to customize their accounts.
* Custom fields are created using SuiteBuilder point-and-click customization tools.
*/
/**
* Sets the given field to disabled or enabled based on the value (true or false)
*
* This API is supported in client scripts only.
*
* @param {string} fieldName The internal ID name of the field to enable/disable
* @param {boolean} value If set to true the field is disabled. If set to false it is enabled
*
* @return {void}
*/
function nlapiDisableField(fieldName, value) {
}
/**
* Return field definition for a field
*
* @param {string} fieldName the name of the field
*
* @return {nlobjField}
* @since 2009.1
*/
function nlapiGetField(fieldName) {
}
/**
* Return field mandatoriness
*
* @param {string} fieldName field name
*
* @return {boolean}
* @since 2009.1
*/
function nlapiGetFieldMandatory(fieldName) {
}
/**
* Return the display value of a select field's current selection on the current record on a page
*
* @restriction supported in client and user event scripts only
*
* @param {string} fieldName the field name
*
* @return {string}
* @since 2005.0
*/
function nlapiGetFieldText(fieldName) {
}
/**
* Return the values (via display text) of a multiselect field on the current record
*
* @restriction supported in client and user event scripts only
*
* @param {string} fieldName field name
*
* @return {string[]}
* @since 2009.1
*/
function nlapiGetFieldTexts(fieldName) {
}
/**
* Return the value of a field on the current record on a page
*
* @restriction supported in client and user event scripts only
*
* @param {string} fieldName the field name
*
* @return {string}
* @since 2005.0
*/
function nlapiGetFieldValue(fieldName) {
}
/**
* Return the values of a multiselect field on the current record on a page
*
* @restriction supported in client and user event scripts only
*
* @param {string} fieldName the field name
*
* @return {string[]}
* @since 2005.0
*/
function nlapiGetFieldValues(fieldName) {
}
/**
* Adds a select option to a scripted select or multiselect field
*
* @restriction Client SuiteScript only
*
* @param {string} fieldName field name
* @param {string} value internal ID for select option
* @param {string} text display text for select option
* @param {boolean} [selected] if true then option will be selected by default
*
* @return {void}
* @since 2008.2
*/
function nlapiInsertSelectOption(fieldName, value, text, selected) {
}
/**
* Performs a search for one or more body fields on a record
*
* This function supports joined-field lookups. Note that the notation for joined fields is: join_id.field_name
*
* Note: Long text fields are truncated at 4000 characters in search/lookup operations
* This API is available in client, user event, scheduled, portlet, and Suitelet scripts.
*
* @governance 10 units for transactions, 2 for custom records, 5 for all other records
*
* @param {string} type The record internal ID name
* @param {int} id The internalId for the record, for example 777 or 87
* @param {string|string[]} fields Sets an array of column/field names to look up, or a single column/field name.
* The fields parameter can also be set to reference joined fields
* @param {boolean} [text=false] If false the internal ID of the drop-down field is returned.
* If set to true, this argument returns the UI display name for this field or fields
* (valid only for SELECT|IMAGE|DOCUMENT fields)
*
* @return {string|Object} A single value (or text) or an associative Array of field name -> value (or text) pairs
* depending on the field’s argument.
*/
function nlapiLookupField(type, id, fields, text) {
}
/**
* Removes a select option (or all if value is null) from a scripted select or multiselect field
*
* @restriction Client SuiteScript only
*
* @param {string} fieldName field name
* @param {string} value internal ID of select option to remove
*
* @return {void}
* @since 2008.2
*/
function nlapiRemoveSelectOption(fieldName, value) {
}
/**
* Make a field mandatory
*
* @param {string} fieldName field name
* @param {boolean} mandatory if true then field is made mandatory
*
* @return {void}
* @since 2009.1
*/
function nlapiSetFieldMandatory(fieldName, mandatory) {
}
/**
* Set the value of a field on the current record on a page using it's label
* @restriction synchronous arg is only supported in client SuiteScript
*
* @param {string} fieldName the field name
* @param {string} txt display name used to lookup field value
* @param {boolean} [fireFieldChanged=true] if false then the field change event is suppressed
* @param {boolean} [synchronous=false] if true then sourcing and field change execution happens synchronously
*
* @return {void}
* @since 2005.0
*/
function nlapiSetFieldText(fieldName, txt, fireFieldChanged, synchronous) {
}
/**
* Set the values (via display text) of a multiselect field on the current record on a page
*
* @restriction supported in client and user event scripts only
* @restriction synchronous arg is only supported in client SuiteScript
*
* @param {string} fieldName field name
* @param {string[]} texts array of strings containing display values for field
* @param {boolean} [fireFieldChanged=true] if false then the field change event is suppressed
* @param {boolean} [synchronous=false] if true then sourcing and field change execution happens synchronously
*
* @return {void}
* @since 2009.1
*/
function nlapiSetFieldTexts(fieldName, texts, fireFieldChanged, synchronous) {
}
/**
* Set the value of a field on the current record on a page
* @restriction supported in client and user event scripts only
* @restriction synchronous arg is only supported in client SuiteScript
*
* @param {string} fieldName the field name
* @param {string} value value used to set field
* @param {boolean} [fireFieldChanged=true] if false then the field change event is suppressed
* @param {boolean} [synchronous=false] if true then sourcing and field change execution happens synchronously
*
* @return {void}
* @since 2005.0
*/
function nlapiSetFieldValue(fieldName, value, fireFieldChanged, synchronous) {
}
/**
* Set the values of a multiselect field on the current record on a page
*
* @restriction supported in client and user event scripts only
* @restriction synchronous arg is only supported in client SuiteScript
*
* @param {string} fieldName field name
* @param {string[]} values array of strings containing values for field
* @param {boolean} [fireFieldChanged=true] if false then the field change event is suppressed
* @param {boolean} [synchronous=false] if true then sourcing and field change execution happens synchronously
*
* @return {void}
* @since 2005.0
*/
function nlapiSetFieldValues(fieldName, values, fireFieldChanged, synchronous) {
}
/**
* Submit the values of a field or set of fields for an existing record
*
* @governance 10 units for transactions, 2 for custom records, 4 for all other records
* @restriction only supported for records and fields where DLE (Direct List Editing) is supported
*
* @param {string} type The record type name
* @param {int} id The internal ID for the record
* @param {string, string[]} fields field or fields being updated
* @param {string, string[]} values field value or field values used for updating
* @param {boolean} [doSourcing=false] If not set, this argument defaults to false and field sourcing does not occur
* @return {void}
* @since 2008.1
*/
function nlapiSubmitField(type, id, fields, values, doSourcing) {
}
/**
* Core descriptor for fields used to define records and also used to build pages and portlets
*
* This object is READ-ONLY except for scripted fields created via the UI Object API using Suitelets
* or beforeLoad user events
*
* Important Things to Note about nlobjField:
* • To add a nlobjField object to an existing NetSuite form (that appears on a record),
* use a beforeLoad user event script.
*
* • To add a nlobjField object to a Suitelet, you must create a custom form using nlapiCreateForm(title, hideNavbar),
* which returns an nlobjForm object. Once the form object is instantiated, add a new field to the form using
* the nlobjForm.addField(name, type, label, sourceOrRadio, tab) method, which returns a reference to nlobjField.
*
* • To return a reference to an nlobjField object, use nlapiGetField(fieldName) (for body fields) or
* nlapiGetLineItemField(type, fieldName, linenum) (for sublist fields). If you do not know the difference
* between a body field and a sublist field, see Working with Fields Overview in the NetSuite Help Center.
*
* • If you use nlapiGetField(fieldName) in a client script to return a nlobjField object, the object returned
* is read-only. This means that you can use nlobjField getter methods on the object, however, you cannot
* use nlobjField setter methods to set field properties.
*
* • Be aware of any special permissions that might be applied to a field. For example, a permission error will
* be thrown if you attempt to get select options on a field that has been disabled on a form.
*
* @constructor
*/
function nlobjField() {
}
/**
* Return field name
* @return {string}
* @since 2009.2
*/
nlobjField.prototype.getName = function() {
};
/**
* Return field label
* @return {string}
* @since 2009.2
*/
nlobjField.prototype.getLabel = function() {
};
/**
* Return field type
* @return {string}
* @since 2009.2
*/
nlobjField.prototype.getType = function() {
};
/**
* Return true if field is hidden
* @return {boolean}
* @since 2009.2
*/
nlobjField.prototype.isHidden = function() {
};
/**
* Return true if field is mandatory
* @return {boolean}
* @since 2009.2
*/
nlobjField.prototype.isMandatory = function() {
};
/**
* Return true if field is disabled
* @return {boolean}
* @since 2009.2
*/
nlobjField.prototype.isDisabled = function() {
};
/**
* Set the label for this field
* This method is only supported on scripted fields via the UI Object API
*
* @param {string} label
* @return {nlobjField}
* @since 2008.2
*/
nlobjField.prototype.setLabel = function(label) {
};
/**
* Set the alias used to set the value for this field. Defaults to field name
* This method is only supported on scripted fields via the UI Object API
*
* @param {string} alias column used to populate the field (mostly relevant when populating sublist fields)
* @return {nlobjField}
* @since 2008.2
*/
nlobjField.prototype.setAlias = function(alias) {
};
/**
* Set the default value for this field
* This method is only supported on scripted fields via the UI Object API
*
* @param {string} value
* @return {nlobjField}
* @since 2008.2
*/
nlobjField.prototype.setDefaultValue = function(value) {
};
/**
* Disable field via field metadata
* This method is only supported on scripted fields via the UI Object API
* @param {boolean} disabled if true then field should be disabled
* @return {nlobjField}
* @since 2009.2
*/
nlobjField.prototype.setDisabled = function(disabled) {
};
/**
* Make this field mandatory
* This method is only supported on scripted fields via the UI Object API
*
* @param {boolean} mandatory if true then field becomes mandatory
* @return {nlobjField}
* @since 2008.2
*/
nlobjField.prototype.setMandatory = function(mandatory) {
};
/**
* Set the max-length for this field (only valid for certain field types)
* This method is only supported on scripted fields via the UI Object API
*
* @param {int} maxLength maximum length for this field
* @return {nlobjField}
* @since 2008.2
*/
nlobjField.prototype.setMaxLength = function(maxLength) {
};
/**
* Set the display type for this field
*
* @param {string} type • hidden – Hides the field on the form.
* • inline – Not supported in client side scripts.
* • readonly – Disables the field. The field is still selectable and
* scrollable. Supported with textarea fields and rich text fields.
* • entry – Makes a sublist field appear as a data entry input field.
* Supported with non-checkbox select fields.
* • disabled - Disables the field from the users' changes.
* • normal - Makes the field appear as normal input field.
* Supported with non-sublist fields.
* @return {nlobjField}
* @since 2008.2
*/
nlobjField.prototype.setDisplayType = function(type) {
};
/**
* Set the break type (startcol|startrow|none) for this field.
* startrow is only used for fields with a layout typeof outside
* This method is only supported on scripted fields via the UI Object API
*
* @param {string} breaktype break type used to add a break in flow layout for this field: startcol|startrow|none
* @return {nlobjField}
* @since 2009.2
*/
nlobjField.prototype.setBreakType = function(breaktype) {
};
/**
* Set the layout type and optionally the break type
* This method is only supported on scripted fields via the UI Object API
*
* @param {string} type layout type: outside|startrow|midrow|endrow|normal
* @param {string} [breakType] break type: startcol|startrow|none
* @return {nlobjField}
* @since 2008.2
*/
nlobjField.prototype.setLayoutType = function(type, breakType) {
};
/**
* Set the text that gets displayed in lieu of the field value for URL fields
*
* @param {string} text user-friendly display value in lieu of URL
* @return {nlobjField}
* @since 2008.2
*/
nlobjField.prototype.setLinkText = function(text) {
};
/**
* Set the width and height for this field
* This method is only supported on scripted fields via the UI Object API
*
* @param {int} width
* @param {int} height
* @return {nlobjField}
* @since 2008.2
*/
nlobjField.prototype.setDisplaySize = function(width, height) {
};
/**
* Set the amount of empty vertical space (rows) between this field and the previous field
* This method is only supported on scripted fields via the UI Object API
*
* @param {int} padding # of empty rows to display above field
* @return {nlobjField}
* @since 2008.2
*/
nlobjField.prototype.setPadding = function(padding) {
};
/**
* Set help text for this field. If inline is set on assistant pages, help is displayed inline below field
* This method is only supported on scripted fields via the UI Object API
*
* @param {string} help field level help content (rich text) for field
* @param {string} [inline] if true then in addition to the popup field help, the help will also be displayed
* inline below field (supported on assistant pages only)
* @return {nlobjField}
* @since 2009.2
*/
nlobjField.prototype.setHelpText = function(help, inline) {
};
/**
* Add a select option to this field (valid for select/multiselect fields)
* This method is only supported on scripted fields via the UI Object API
*
* @param {string} value internal ID for this select option
* @param {string} text display value for this select option
* @param {boolean} [selected] if true then this select option will be selected by default
* @since 2008.2
*/
nlobjField.prototype.addSelectOption = function(value, text, selected) {
};
/**
* Use this API to obtain a list of available options on a select field
*
* This API can be used on both standard and custom select fields. Only the first 1,000 available
* options will be returned by this API.
* This method can only be used in server contexts against a record object. Also note that a call to this
* method may return different results for the same field for different roles.
* If you attempt to get select options on a field that is not a select field, or if you reference a field
* that does not exist on the form, null is returned.
*
* @param {string} [filter] A search string to filter the select options that are returned.
* For example, if there are 50 select options available, and 10 of the options
* contains 'John', e.g. “John Smith” or “Shauna Johnson”, only those 10 options will be returned.
*
* Note: Filter values are case insensitive.
* The filters 'John' and 'john' will return the same select options.
* @param {string} [filterOperator='contains'] Supported operators are contains | is | startswith.
* If not specified, defaults to the contains operator.
*
* @return {nlobjSelectOption}
* @since 2009.2
*/
nlobjField.prototype.getSelectOptions = function(filter, filterOperator) {
};
/**
* Select|radio option used for building select fields via the UI Object API and for describing select|radio fields
*
* @constructor
* @since 2009.2
*/
function nlobjSelectOption() {
}
/**
* Return internal ID for select option
*
* @return {string}
* @since 2009.2
*/
nlobjSelectOption.prototype.getId = function() {
};
/**
* Return display value for select option
*
* @return {string}
* @since 2009.2
*/
nlobjSelectOption.prototype.getText = function() {
};