This topic contains 8 replies, has 0 voices, and was last updated by jmessersmith 8 years, 4 months ago.

  • Author
    Posts
  • #6332

    jmessersmith

    I’m trying to load a saved search. I’ve read in other threads about a bug that happens when your saved search is too complex. I’m wondering if I am hitting that bug and if there is some work around.

    My code will return the correct number in the array but all I get is Nulls when I go to read records.

    Here is my code, its pretty simple.

    Code:
    function testsearch(){
    var searchresults = nlapiSearchRecord(“transaction”, 2323);
    if(searchresults == null)
    {
    // no results returned by search
    }
    else
    {
    for ( var i = 0; searchresults != null && i This is a cached copy. Click here to see the original post.

  • #6333

    CREECE

    You could wrap your nlapiSearchRecord in a try / catch to see if it is throwing an error. The error message may / may not be helpful. You should be able to paste this in the console and run it (may have to refresh a couple of times in Chrome. For some reason it doesn’t always load the nlapi).

  • #6334

    j.j

    i dont see any error in the search code – the error should be in loading the system note record – i dont think you can load a system note record as it is child record of any object in NS and cannot exist without parent. Try loading the NS object and then read the system note sublist.

  • #6335

    khultquist

    can you copy/paste the results of your nlapiLogExecution

  • #6336

    jmessersmith

    Nothing is throwing an error, I just don’t get a result.

    the results of nlapiLogExecution is this:

    null:null

    ​null:null

    ​null:null

    ​null:null

    ​null:null

    ​null:null

    ​null:null

    ​null:null

    ​null:null

    ​null:null

    ​null:null

    ​null:null

    ​null:null

    ​null:null

    ​null:null

    ​null:null

    ​​

    It returns the same number of lines that exist in the saved search.

  • #6337

    al3xicon

    Does your search contain grouped results? I’ve found that when that’s the case, result.getId() doesn’t return anything, so I have to explicitly include the grouped internal ID field in the results of the search. Not sure about getRecordType(), but it’s possible that it is suffering the same fate – IF you are grouping.

  • #6338

    jmessersmith

    The internal ID wasn’t included, I added it but still get the same result.

    Here is the criteria

    And results:

  • #6339

    khultquist

    al3xicon is right, since you are summarizing/grouping, you have to use a different technique. Try something like this

    searchresults[i].getValue(‘internalid’, null, ‘group’);

  • #6340

    jmessersmith

    Yup that was it, Thanks guys. Maybe this quirky stuff is fixed in 2.0?

You must be logged in to reply to this topic.