This topic contains 4 replies, has 0 voices, and was last updated by johnsongilpp 7 years, 10 months ago.

  • Author
    Posts
  • #1404

    johnsongilpp

    Hi,

    When using record.getLineCount in it only returns the first page of items, which is the first 500. Is there a method where you’re supposed to get the pages and loop though them? I can’t find anything in the documentation. Additionally, using the findSublistLineWithValue method will only finds the line if it’s in the first page of items. I’m creating a bin put away record that has 24,000 items and need the api to pull all items and search through every item in the sublist. I’m I missing something here? My code is below. The snippets are part of the same script but serve two different functions.Thanks for any advice.

    var inventory_adjustment = record.create({

    type: record.Type.BIN_WORKSHEET,

    isDynamic: true,

    });

    var numLines = inventory_adjustment.getLineCount({

    sublistId: ‘item’

    });

    ////////////////////////——————\\\\\\\\\\\

    var lineNumber = inventory_adjustment.findSublistLineWithValue({

    sublistId: ‘item’,

    fieldId: ‘item’,

    value: itemId

    });
    This is a cached copy. Click here to see the original post.

  • #1405

    Olivier Gagnon NC

    Out of curiosity, what are the results of the getLineCount if you do isDynamic false?


    johnsongilpp replied on 12/28/2016, 09:09 AM: The bin putaway can only be created in dynamic mode.

  • #1406

    chanarbon

    Another thing would be on what script type does this scenario come in and on what trigger. How about trying it on the context of user event’s beforeSubmit’s newRecord.

  • #1407

    fjannelle

    Good morning,

    The Bin Worksheet records are unlike any other records in the SuiteScript world.

    You came across one of their significant flaws: pagination.

    When you access the bin worksheet via the user interface you will notice that indeed only 500 items are shown (I remember that number being 1,000 in other accounts, this might be related to the maximum number of entries in a sublist user preference) and a pagination dropdown is available on your right. When creating or accessing a bin worksheet record via SuiteScript you will experience the exact same thing. On top of that, filters and sorting applied by the user will reflect to the inventory worksheets created by this user. Even if created via scripting. This means that if the logged in user changes the sorting column via the user interface and then triggers the script creating the bin worksheet the SAME sorting and filtering is applied.

    You also mentioned that you have 24,000 items to adjust which will throw you another curve-ball. Here comes the second significant flaw: Only up to 10,000 items are available to be adjusted.

    If the NetSuite account has more than 10,000 items, NetSuite will only display the first 10,000 items.

    Two pretty significant hurdles that need to be overcome.

    I do not have specific details on your script but here is what I would advise: Leverage the user interface sorting and filters

    For example, you could sort by Item Name and adjust the first 500 items based on the items displayed on the first page. Then repeat for each page.

    To handle the 10,000 items limitation you NEED to use filters. If you are able to filter by class, department or any other regular field it is ideal. Otherwise you can stamp a custom freeform text field on the Item records and leverage that (for filtering and sorting). Personally, we built a process around the use of that custom freeform text field.

    For your information, these hurdles have been there for a while. I believe I first encountered them in 2011 or 2012. So it is unlikely that anything will be done to ‘resolve’ them in the near future. They are likely considered ‘as designed’ at this point. The good thing is we can work around them to achieve the desired results.

    Best regards,

  • #1408

    johnsongilpp

    Thanks everyone. NetSuite has informed me that it’s a current enhancement request to return more than 500 line items with the getLineCount function.

You must be logged in to reply to this topic.