-
Notifications
You must be signed in to change notification settings - Fork 7
/
snippets.cson
662 lines (577 loc) · 22.3 KB
/
snippets.cson
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
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
'.source.js':
'NetSuite Sublist For Loop':
'prefix':'for(var line = 1; line <= lineItemCount; line++)'
'description': 'The for statement creates a loop that consists of three optional expressions, enclosed in parentheses and separated by semicolons, followed by a statement (usually a block statement) to be executed in the loop.'
'rightLabelHTML': '<span style="color:#EF490F">3EN - Netsuite</span>'
'descriptionMoreURL': 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for'
'body':"""for(var line = 1; line <= lineItemCount; line++) {$1}"""
'NetSuite Search':
'prefix':'search'
'description': 'Load the search module to create and run on demand or saved searches and analyze and iterate through the search results. You can search for a single record by keywords, create saved searches, search for duplicate records, or return a set of records that match filters you define.'
'rightLabelHTML': '<span style="color:#EF490F">3EN - Netsuite</span>'
'descriptionMoreURL': 'https://system.netsuite.com/app/help/helpcenter.nl?fid=section_4345764122.html'
'body':"""
const $1 = search.create({
type: $2,
filters: [{
name: '$3',
operator: '$4'
}],
columns: [$5]
});
$1.run().each(($6) => {
$7
return true;
});
"""
'NetSuite Define':
'prefix':'define'
'description': 'The define Function is a global object that implements a define() Module Loader interface for SuiteScript 2.0. It conforms to the Asynchronous Module Definition (AMD) specification.'
'rightLabelHTML': '<span style="color:#EF490F">3EN - Netsuite</span>'
'descriptionMoreURL': 'https://system.netsuite.com/app/help/helpcenter.nl?fid=section_4387811519.html'
'body':"""
/**
* @NApiVersion 2.x
* @NModuleScope Public
* 3EN Cloud Ltd.
* @module $1
* @description $2
*/
define([$3], ($4) => {
return /** @alias module:$1 */ {
$5
};
});
"""
'NetSuite Restlet':
'prefix':'restlet'
'description': 'A RESTlet is a SuiteScript that you make available for other applications to call, either from an external application or from within NetSuite. When an application or another script calls a RESTlet, the RESTlet script executes and, in some cases, returns a value to the calling application.'
'rightLabelHTML': '<span style="color:#EF490F">3EN - Netsuite</span>'
'descriptionMoreURL': 'https://system.netsuite.com/app/help/helpcenter.nl?fid=section_4387799403.html'
'body':"""
/**
* @NApiVersion 2.x
* @NScriptType restlet
* @NAmdConfig ../unio-config.json
* 3EN Cloud Ltd.
* @module $1
* @description $2
*/
define([$3], ($4) => {
/**
* @function get
* @description description
*
* @public
* @param {type} - description
* @return {type} - description
*/
function get($5) {
}
/**
* @function delete
* @description description
*
* @public
* @param {type} - description
* @return {type} - description
*/
function delete($6) {
}
/**
* @function put
* @description description
*
* @public
* @param {type} - description
* @return {type} - description
*/
function put($7) {
}
/**
* @function post
* @description description
*
* @public
* @param {type} - description
* @return {type} - description
*/
function post($8) {
}
return /** @alias module:$1 */ {
get,
delete,
put,
post
};
});
"""
'NetSuite User Event':
'prefix':'userEvent'
'description': 'User event scripts are executed on the NetSuite server. They are executed when users perform certain actions on records, such as create, load, update, copy, delete, or submit. Most standard NetSuite records and custom record types support user event scripts.'
'rightLabelHTML': '<span style="color:#EF490F">3EN - Netsuite</span>'
'descriptionMoreURL': 'https://system.netsuite.com/app/help/helpcenter.nl?fid=section_4387799721.html'
'body':"""
/**
* @NApiVersion 2.x
* @NScriptType UserEventScript
* @NModuleScope Public
* 3EN Cloud Ltd.
* @module $1
* @description $2
*/
define([$3], ($4) => {
/**
* @function afterSubmit
* @description description
*
* @public
* @param {type} scriptContext description
* @return {type} - description
*/
function afterSubmit(scriptContext) {
}
/**
* @function beforeLoad
* @description description
*
* @public
* @param {type} scriptContext description
* @return {type} - description
*/
function beforeLoad(scriptContext) {
}
/**
* @function beforeSubmit
* @description description
*
* @public
* @param {type} scriptContext description
* @return {type} - description
*/
function beforeSubmit(scriptContext) {
}
return /** @alias module:$1 */ {
afterSubmit,
beforeLoad,
beforeSubmit
};
});
"""
'NetSuite Bundle Installation Script':
'prefix':'bundleInstallationScript'
'description': 'Bundle installation scripts are specialized server scripts that perform processes in target accounts as part of a bundle installation, update, or uninstall. These processes include setup, configuration, and data management tasks that would otherwise have to be completed by account administrators.
Every bundle can include a bundle installation script that is automatically run when the bundle is installed, upgraded, or uninstalled. Each bundle installation script can contain triggers to be executed before install, after install, before update, after update, and after uninstall.'
'rightLabelHTML': '<span style="color:#EF490F">3EN - Netsuite</span>'
'descriptionMoreURL': 'https://system.netsuite.com/app/help/helpcenter.nl?fid=section_4460460309.html'
'body':"""
/**
* @NApiVersion 2.x
* @NModuleScope Public
* @NScriptType BundleInstallationScript
* 3EN Cloud Ltd.
* @module $1
* @description $2
*/
define([$3], ($4) => {
/**
* @function afterInstall
* @description description
*
* @public
* @param {type} toversion description
* @return {type} - description
*/
function afterInstall(toversion) {
}
/**
* @function afterUpdate
* @description description
*
* @public
* @param {type} fromversion description
* @param {type} toversion description
* @return {type} - description
*/
function afterUpdate(fromversion, toversion) {
}
/**
* @function beforeInstall
* @description description
*
* @public
* @param {type} toversion description
* @return {type} - description
*/
function beforeInstall(toversion) {
}
/**
* @function beforeUninstall
* @description description
*
* @public
* @param {type} toversion description
* @return {type} - description
*/
function beforeUninstall(toversion) {
}
/**
* @function beforeUpdate
* @description description
*
* @public
* @param {type} fromversion description
* @param {type} toversion description
* @return {type} - description
*/
function beforeUpdate(fromversion, toversion) {
}
return /** @alias module:$1 */ {
afterInstall,
afterUpdate,
beforeInstall,
beforeUninstall,
beforeUpdate
};
});
"""
'NetSuite Suitelet':
'prefix':'suitelet'
'description': 'Suitelets are extensions of the SuiteScript API that allow you to build custom NetSuite pages and backend logic. Suitelets are server-side scripts that operate in a request-response model, and are invoked by HTTP GET or POST requests to system generated URLs.'
'rightLabelHTML': '<span style="color:#EF490F">3EN - Netsuite</span>'
'descriptionMoreURL': 'https://system.netsuite.com/app/help/helpcenter.nl?fid=section_4387799600.html'
'body':"""
/**
* @NApiVersion 2.x
* @NModuleScope Public
* @NScriptType Suitelet
* 3EN Cloud Ltd.
* @module $1
* @description $2
*/
define([$3], ($4) => {
/**
* @function onRequest
* @description description
*
* @public
* @param {Object} params description
*/
function onRequest(params) {
}
return /** @alias module:$1 */ {
onRequest
};
});
"""
'NetSuite Scheduled Script':
'prefix':'scheduledScript'
'description': 'Scheduled scripts are server-side scripts that are executed (processed) with SuiteCloud Processors. You can deploy scheduled scripts so they are submitted for processing at a future time, or at future times on a recurring basis. You can also submit scheduled scripts on demand from the deployment record or from another script with the task.ScheduledScriptTask API.'
'rightLabelHTML': '<span style="color:#EF490F">3EN - Netsuite</span>'
'descriptionMoreURL': 'https://system.netsuite.com/app/help/helpcenter.nl?fid=section_4387799491.html'
'body':"""
/**
* @NApiVersion 2.x
* @NModuleScope Public
* @NScriptType ScheduledScript
* 3EN Cloud Ltd.
* @module $1
* @description $2
*/
define([$3], ($4) => {
/**
* @function execute
* @description description
*
* @public
* @param {Object} context description
*/
function execute(context) {
}
return /** @alias module:$1 */ {
execute
};
});
"""
'NetSuite Workflow Action Script':
'prefix':'workflowAction'
'description': 'Workflow action scripts allow you to create custom Workflow Actions that are defined on a record in a workflow. Workflow action scripts are useful for performing actions on sublists because sublist fields are not currently available through the Workflow Manager. Workflow action scripts are also useful when you need to create custom actions that execute complex computational logic that is beyond what can be implemented with the built-in actions.'
'rightLabelHTML': '<span style="color:#EF490F">3EN - Netsuite</span>'
'descriptionMoreURL': 'https://system.netsuite.com/app/help/helpcenter.nl?fid=section_4460429314.html'
'body':"""
/**
* @NApiVersion 2.x
* @NModuleScope Public
* @NScriptType WorkflowActionScript
* 3EN Cloud Ltd.
* @module $1
* @description $2
*/
define([$3], ($4) => {
/**
* @function onAction
* @description description
*
* @public
* @param {Object} scriptContext description
*/
function onAction(scriptContext) {
}
return /** @alias module:$1 */ {
onAction
};
});
"""
'NetSuite Portlet':
'prefix':'portlet'
'description': 'Portlet scripts are run on the server and are rendered in the NetSuite dashboard.'
'rightLabelHTML': '<span style="color:#EF490F">3EN - Netsuite</span>'
'descriptionMoreURL': 'https://system.netsuite.com/app/help/helpcenter.nl?fid=section_4387799288.html'
'body':"""
/**
* @NApiVersion 2.x
* @NModuleScope Public
* @NScriptType Portlet
* 3EN Cloud Ltd.
* @module $1
* @description $2
*/
define([$3], ($4) => {
/**
* @function render
* @description description
*
* @public
* @param {Object} params description
*/
function render(params) {
}
return /** @alias module:$1 */ {
render
};
});
"""
'NetSuite Mass Update':
'prefix':'massUpdateScript'
'description': 'Mass update scripts allow you to programmatically perform custom updates to fields that are not available through general mass updates. Mass update scripts can run complex calculations, as defined in your script, across records.'
'rightLabelHTML': '<span style="color:#EF490F">3EN - Netsuite</span>'
'descriptionMoreURL': 'https://system.netsuite.com/app/help/helpcenter.nl?fid=section_4460452911.html'
'body':"""
/**
* @NApiVersion 2.x
* @NModuleScope Public
* @NScriptType MassUpdateScript
* 3EN Cloud Ltd.
* @module $1
* @description $2
*/
define([$3], ($4) => {
/**
* @function each
* @description description
*
* @public
* @param {Object} params description
*/
function each(params) {
}
return /** @alias module:$1 */ {
each
};
});
"""
'NetSuite Map Reduce':
'prefix':'mapReduce'
'description': 'The map/reduce script type is designed for scripts that need to handle large amounts of data. It is best suited for situations where the data can be divided into small, independent parts. When the script is executed, a structured framework automatically creates enough jobs to process all of these parts. Map/reduce is ideal for scenarios where you want to apply the same logic repeatedly — once for each object in a series.'
'rightLabelHTML': '<span style="color:#EF490F">3EN - Netsuite</span>'
'descriptionMoreURL': 'https://system.netsuite.com/app/help/helpcenter.nl?fid=section_4387799161.html'
'body':"""
/**
* @NApiVersion 2.x
* @NModuleScope Public
* @NScriptType MapReduceScript
* 3EN Cloud Ltd.
* @module $1
* @description $2
*/
define([$3], ($4) => {
/**
* @function getInputData
* @description description
*
* @public
* @return {type} Description
* @param {Object} inputContext description
*/
function getInputData(inputContext) {
}
/**
* @function map
* @description description
*
* @public
* @param {Object} mapContext description
*/
function map(mapContext) {
for (var i = 0; mapContext.value && i < mapContext.value.length; i++)
if ($6) {
mapContext.write({
key: $7,
value: $8
});
}
}
/**
* @function reduce
* @description description
*
* @public
* @param {Object} reduceContext description
*/
function reduce(reduceContext) {
reduceContext.write({
key: $9,
value: $10
});
}
/**
* @function summarize
* @description description
*
* @public
* @param {Object} summaryContext description
*/
function summarize(summaryContext) {
}
return /** @alias module:$1 */ {
getInputData,
map,
reduce,
summarize
};
});
"""
'NetSuite Client Script':
'prefix':'clientScript'
'description': 'Client scripts are scripts that are executed by predefined event triggers in a browser. They can validate user-entered data and auto-populate fields or sublists at various form events.'
'rightLabelHTML': '<span style="color:#EF490F">3EN - Netsuite</span>'
'descriptionMoreURL': 'https://system.netsuite.com/app/help/helpcenter.nl?fid=section_4387798404.html'
'body':"""
/**
* @NApiVersion 2.x
* @NModuleScope Public
* @NScriptType ClientScript
* 3EN Cloud Ltd.
* @module $1
* @description $2
*/
define([$3], ($4) => {
/**
* @function pageInit
* @description description
*
* @public
* @param {Object} context description
*/
function pageInit(context) {
}
/**
* @function saveRecord
* @description description
*
* @public
* @param {Object} context description
* @return {Boolean} description
*/
function saveRecord(context) {
}
/**
* @function validateField
* @description description
*
* @public
* @param {Object} context description
* @return {Boolean} description
*/
function validateField(context) {
}
/**
* @function fieldChanged
* @description description
*
* @public
* @param {Object} context description
*/
function fieldChanged(context) {
}
/**
* @function postSourcing
* @description description
*
* @public
* @param {Object} context description
* @return {Boolean} description
*/
function postSourcing(context) {
}
/**
* @function lineInit
* @description description
*
* @public
* @param {Object} context description
*/
function lineInit(context) {
}
/**
* @function validateDelete
* @description description
*
* @public
* @param {Object} context description
* @return {Boolean} description
*/
function validateDelete(context) {
}
/**
* @function validateInsert
* @description description
*
* @public
* @param {Object} context description
*/
function validateInsert(context) {
}
/**
* @function validateLine
* @description description
*
* @public
* @param {Object} context description
* @return {Boolean} description
*/
function validateLine(context) {
}
/**
* @function sublistChanged
* @description description
*
* @public
* @param {Object} context description
*/
function sublistChanged(context) {
}
return /** @alias module:$1 */ {
pageInit,
fieldChanged,
postSourcing,
sublistChanged,
lineInit,
validateField,
validateLine,
validateInsert,
validateDelete,
saveRecord
};
});
"""