[ESS] Working with Sublists in SuiteScript 2.0

  Рет қаралды 5,992

Stoic Software

Stoic Software

Күн бұрын

Пікірлер: 8
@hlf_coder6272
@hlf_coder6272 6 жыл бұрын
Stoic Software I'd like to thank you for the video. After a couple hours of fighting with a sublist, your video gave me the answer I needed. I didn't realize they had changed the index number to be zero based. I wish they had documented it a little better or gave a more meaningful exception, but either way I appreciate the vid . I was approaching the hair pulling stage.
@kunaldhuria3935
@kunaldhuria3935 2 жыл бұрын
You are a life saver man! God bless you
@manjulaamarasekara8093
@manjulaamarasekara8093 6 жыл бұрын
Hi Stoic, Can you also demonstrate how to add values to a sublist from inside of a for-loop? That is, I have a list of search results and I need to add them to a sublist of my "form" object. I am using setSublistValue() method to do it. But the values do not get added to the sublist.
@hlf_coder6272
@hlf_coder6272 6 жыл бұрын
Manjula Amaresekara I would first make sure you're using the proper sublist field id in your call to setSublistValue. If the field id you're using doesn't exist, it doesn't throw an exception, but your item isn't added, which seems to be what you're describing. In other words, if you add a field to your sublist like this: sublist.addField({ id: 'custpage_tranid', label: 'Transaction Id', type: serverWidget.FieldType.TEXT }); When you call setSublistValue, make sure the 'id' property is set correctly. Something like the code below, which is partial code that more or less does what you're looking to do. Meaning, it's a working example of looping through search results and adding them to a sublist. I can't really post the whole thing here but hopefully it's enough to help. for (var i = 0; i < studentInvoices.length; i++) { var currentInvoice = studentInvoices[I]; sublist.setSublistValue({ id: 'custpage_tranid', line: i, value: currentInvoice.getValue({name: 'tranid'}) }); }
@ryancole6165
@ryancole6165 6 жыл бұрын
Hi, any idea how to delete all line items before adding programmatically? I'm receiving the following error: error.SuiteScriptError\",\"name\":\"SSS_INVALID_SUBLIST_OPERATION var itemCount = order.getLineCount({"sublistId": "item"}); for (var i = 0; i < itemCount; i++) { try { order.removeLine({ sublistId: "item", line: i }); log.debug({details:"removed line = " + i}); } catch (e) { // Fails silently log.error({details:"error = " + e}); } }
@grubes34
@grubes34 6 жыл бұрын
When you remove lines, you need to start at the end of the list and go backward. If you start at the beginning and move forward, you will loop too far and eventually start removing non-existent lines. Start your loop at `itemCount` and work your way back to 0.
@ryancole6165
@ryancole6165 6 жыл бұрын
Interesting. It works however I had to use "ItemCount -1" as the sublist array starts at 0. Thanks again.
@umeshshukla7633
@umeshshukla7633 7 жыл бұрын
A very helpful video, can you please give some idea on "How to debug SuiteScript 2.0 (RESTlet) in Netsuite Debugger?" Thanks in advance.
[ESS] Logging in SuiteScript 2.0
10:49
Stoic Software
Рет қаралды 2,3 М.
[ESS] The Event Lifecycle of a NetSuite Record
22:37
Stoic Software
Рет қаралды 6 М.
Quando eu quero Sushi (sem desperdiçar) 🍣
00:26
Los Wagners
Рет қаралды 14 МЛН
路飞做的坏事被拆穿了 #路飞#海贼王
00:41
路飞与唐舞桐
Рет қаралды 26 МЛН
The evil clown plays a prank on the angel
00:39
超人夫妇
Рет қаралды 48 МЛН
[ESS] SuiteScript 2.0 Modules
18:53
Stoic Software
Рет қаралды 11 М.
[ESS] Working with Records in SuiteScript 2.0
15:15
Stoic Software
Рет қаралды 6 М.
[ESS] How do I add a button to a NetSuite record with SuiteScript?
18:09
[ESS] A Brief Overview of SuiteScript
11:18
Stoic Software
Рет қаралды 10 М.
NetSuite Script Tutorial - Map Reduce
20:48
Robin Mitchell
Рет қаралды 9 М.
Premature Optimization
12:39
CodeAesthetic
Рет қаралды 840 М.
[ESS] How Do I Display NetSuite Search Results in a Suitelet?
28:25
Stoic Software
Рет қаралды 19 М.
NetSuite Workflow Approvals in 2017.1
20:40
Socius
Рет қаралды 30 М.
Quando eu quero Sushi (sem desperdiçar) 🍣
00:26
Los Wagners
Рет қаралды 14 МЛН