Tagged: assistant sublist
This topic contains 14 replies, has 4 voices, and was last updated by Adolfo Garza 6 years ago.
-
AuthorPosts
-
November 30, 2016 at 4:24 am #1432
starlingMarkI am creating an assistant inside a suitelet in SS 2.0. In one of the steps I am creating a sublist and having the user enter in many lines. In a later step, I am trying to retrieve the line item values that were previously entered.
In this example I have only two line items on the sublist. The sublist is on “step2”.
I can call step2.getLineCount and it properly returns the number of items on the sublist. I then try to iterate over the lines to grab the values. When I perform step2.getSublistValue with a line of 0 it works properly. However, when I increment the line to be 1, I always get an error of SSS_MISSING_REQUIRED_ARGUMENT on options.line.
Anyone else seeing similar behaviour or know what I’m doing wrong?
This is a cached copy. Click here to see the original post. -
November 30, 2016 at 9:14 am #1433
starlingMarkMaybe a NS employee like chanarbon can help?
-
November 30, 2016 at 9:51 am #1434
david.smithCan you post a snip of the code?
-
November 30, 2016 at 11:42 am #1435
starlingMarkPosting code is a very good idea. I should have thought of that. In this example let us assume I’m adding two sublist lines to the sublist “members”.
Setting up the assistant:
Code:
var assistant = serverWidget.createAssistant({ title: ‘Create a New Product’, hideNavBar: true });
var step1 = assistant.addStep({ id: 1, label: ‘Basic Item Information’ });
var step2 = assistant.addStep({ id: 2, label: ‘Select Components’ });
var step3 = assistant.addStep({ id: 3, label: ‘Review’ });
Later we have a sublist in step 2:Code:
var members = assistant.addSublist({ id: ‘members’, label: ‘Components’, type: serverWidget.SublistType.INLINEEDITOR });
var itemField = members.addField({ id: ‘item’, label: ‘Member’, type: serverWidget.FieldType.SELECT, source: ‘item’ });
itemField.isMandatory = true;var quantityField = members.addField({ id: ‘quantity’, label: ‘Quantity’, type: serverWidget.FieldType.FLOAT });
quantityField.isMandatory = true;
When preparing step 3, “Review”, I have this code:Code:
var totalItemMembers = step2.getLineCount({ group: ‘members’ });
log.debug({ title: ‘Total Member Items: ‘ + totalItemMembers }); // Properly logs out 2
for (var z = 0; z < totalItemMembers; z++) {
var currentItem = {};
currentItem.id = step2.getSublistValue({ group: 'members', id: 'item', line: z });
log.debug({ title: 'Item on line ' + z, details: currentItem.id }); // Properly logs out item on line 0, then errors out when trying to get the item on line 1
} -
November 30, 2016 at 11:49 am #1436
chanarbonHi starlingMark ,
I am wondering if you have placed the getting of getSublistValue() on GET instead of POST? I think that is the possible cause of the this concern.
-
November 30, 2016 at 12:01 pm #1437
starlingMarkchanarbon Thank you for the suggestion. I am running this on the GET after the user POSTs step 2. Per your suggestion, I tried putting the 3rd block of code on the POST side and the log shows this:
Total Member Items: -1
So it doesn’t seem to think there is anything on the sublist at all.
Please keep the ideas coming
-
November 30, 2016 at 12:07 pm #1438
starlingMarkActually, I mis-spoke.
I ran assistant.getLastStep().getLineCount({ group: ‘members’ )} and it returned -1.
I just tried step2.getLineCount({ group: ‘members’)} and it returned 2. However, it errors out as before. I can get the item on line 0 but I error out when trying to get the item on line 1. SSS_MISSING_REQUIRED_ARGUMENT on options.line.
-
November 30, 2016 at 12:11 pm #1439
chanarbonHi starlingMark ,
When you had it on POST, have you tried using assistant.getStep({id : }) then perform the getLineCount() and the getSublistValue() from there. The non-step number 1 is best placed on POST so it should have this addressed
-
December 1, 2016 at 4:32 am #1440
starlingMarkchanarbon I have tried as you suggested. Here is the code that I put on POST:
Code:
if (lastStep.id == 2) {
var step2 = assistant.getStep({ id: 2 });
var totalItemMembers = step2.getLineCount({ group: ‘members’ });
log.debug({ title: ‘Total Member Items: ‘ + totalItemMembers });for (var z = 0; z < totalItemMembers; z++) {
log.debug({ title: 'Trying to grab line ' + z });
var currentItem = {};
currentItem.id = step2.getSublistValue({ group: 'members', id: 'item', line: z });log.debug({ title: 'Item ID for line ' + z + ': ' + currentItem.id });
currentItem.pounds = step2.getSublistValue({ group: 'members', id: 'pounds', line: z });
log.debug({ title: 'Item pounds for line ' + z + ': ' + currentItem.pounds });
}
The logs show:Total Member Items: 2 // correct
Trying to grab line 0 // correct
Item ID for line 0: 16791 // correct
Item pounds for line 0: 0.6 // correct
Trying to grab line 1 // correct
JS_EXCEPTION – SSS_MISSING_REQUIRED_ARGUMENT – options.line
As an aside, I tried running my script through the debugger and found that when the script jumps inside of N/ui/serverWidget.js script and the function getLineCount, there is an odd bit of code on lines 1209-1210:
Code:
if (options.line !== 0)
utilityFunctions.throwSuiteScriptError(error.Type.MISSING_REQD_ARGUMENT, 'options.line');
This seems to indicate that if I try to retrieve any line other than 0 the system will throw an error. -
December 1, 2016 at 11:28 am #1441
david.smithHave you tried using selectLine with getCurrentSublistValue?
Reaching for straws here but you never know with NetSuite.
-
January 3, 2017 at 6:50 am #1442
starlingMarkAs a general update for anyone else facing the same issue, my ticket was escalated into a defect. I am awaiting investigation and will post the outcome of that investigation when complete. Thanks again to everyone who offered up suggestions!
-
January 5, 2017 at 10:50 am #1443
starlingMarkHeard back from NS support today. Turns out this is a known defect and will be addressed in the 2017.1 release. So, if you’re making an assistant with sublists, better stick to SS 1.0 for now!
-
September 13, 2017 at 1:45 am #16401
I think my current issue can be related with this post.
When I added a sublist, and click next, I get all the values I entered in the sublist.
But if I go back to the page in which I have the sublist, I get all the values I entered, but the last row is added without displaying any values.
What can be the solution ?
<tr id=”members_row_1″ class=”uir-machine-row uir-machine-row-odd”>
<td class=”listtexthlwht” align=”left” style=”height: 100%;”>TEST</td>
<td class=”listtexthlwht” align=”right” nowrap=”” style=”height: 100%;”>1</td>
<td class=”uir-quickDelete listtexthlwht” style=”width: 14px;”>
</td>
</tr>
<tr id=”members_row_2″ class=”uir-machine-row uir-machine-row-even”>
<td class=”listtexthlwht” align=”left” style=”height: 100%;”> </td>
<td class=”listtexthlwht” align=”right” nowrap=”” style=”height: 100%;”> </td>
<td class=”uir-quickDelete listtexthlwht” style=”width: 14px;”>
</td>
</tr>
-
November 1, 2018 at 10:12 pm #26065
The current release is 2018.2 but still this issue exist.
I have the same problem now.
The only difference is I am setting field values.
The setting of field values are ok with line 0 but when it comes to 1,ย <span style=”color: #000000; font-family: ‘Open Sans’, Helvetica, sans-serif; font-size: 10.6667px;”>{“type”:”error.SuiteScriptError”,”name”:”SSS_INVALID_SUBLIST_OPERATION”,”message”:”You have attempted an invalid sublist or line item operation. You are either trying to access a field on a non-existent line or you are trying to add or remove lines from a static sublist.”,</span>
For now I will try setting the field values on the client script instead of in the suitelet.
-
November 1, 2018 at 10:39 pm #26066
@jhonnel_turinganย If you are trying to remove lines from a fulfillment you might want to set ‘itemreceive’ linefield to false instead.
- This reply was modified 6 years ago by Adolfo Garza.
-
AuthorPosts
You must be logged in to reply to this topic.