This topic contains 14 replies, has 4 voices, and was last updated by Adolfo Garza 5 years, 6 months ago.

  • Author
    Posts
  • #1432 Score: 0

    starlingMark
    • Contributions: 0
    • Level 1

    I 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.

  • #1433 Score: 0

    starlingMark
    • Contributions: 0
    • Level 1

    Maybe a NS employee like chanarbon can help?

  • #1434 Score: 0

    david.smith
    • Contributions: 0
    • Level 1

    Can you post a snip of the code?

  • #1435 Score: 0

    starlingMark
    • Contributions: 0
    • Level 1

    Posting 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
    }

  • #1436 Score: 0

    chanarbon
    • Contributions: 0
    • Level 1

    Hi 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.

  • #1437 Score: 0

    starlingMark
    • Contributions: 0
    • Level 1

    chanarbon 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

  • #1438 Score: 0

    starlingMark
    • Contributions: 0
    • Level 1

    Actually, 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.

  • #1439 Score: 0

    chanarbon
    • Contributions: 0
    • Level 1

    Hi 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

  • #1440 Score: 0

    starlingMark
    • Contributions: 0
    • Level 1

    chanarbon 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.

  • #1441 Score: 0

    david.smith
    • Contributions: 0
    • Level 1

    Have you tried using selectLine with getCurrentSublistValue?

    Reaching for straws here but you never know with NetSuite.

  • #1442 Score: 0

    starlingMark
    • Contributions: 0
    • Level 1

    As 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!

  • #1443 Score: 0

    starlingMark
    • Contributions: 0
    • Level 1

    Heard 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!

  • #16401 Score: 0

    Rosemol J
    Member
    • Contributions: 1
    • Level 1
    @rosemol_j

    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%;”>&nbsp;</td>

    <td class=”listtexthlwht” align=”right” nowrap=”” style=”height: 100%;”>&nbsp;</td>

    <td class=”uir-quickDelete listtexthlwht” style=”width: 14px;”>

    </td>

    </tr>

    • This reply was modified 6 years, 7 months ago by Rosemol J.
    • This reply was modified 6 years, 7 months ago by Rosemol J.
  • #26065 Score: 0

    Jhonnel Turingan
    Member
    • Contributions: 1
    • Level 1
    @jhonnel_turingan

    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.

  • #26066 Score: 0

    Adolfo Garza
    Member
    • Contributions: 17
    • Level 2
    • ☆☆
    @adolfo_garza

    @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 5 years, 6 months ago by Adolfo Garza.

You must be logged in to reply to this topic.