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

  • Author
    Posts
  • #6023

    AGMNS

    We have a custom record that I am searching on in SuiteScript. I am filtering on a date in the custom record and a custom field on the customer record. The customer record is a parent to the custom record. I have tried a couple of instances of filtering based on a filterExpression and standard filter both shown below. I keep getting join errors when running in debugger.

    When run I get “An nlobjSearchFilter contains an invalid join ID, or is not in proper syntax: custentity_cust_corp_dash_account”

    CUSTRECORD_CR_CUSTOMERNAME1 is a field that is populated from the customer list so I’ve tried both the field name (which works in other scripts I have used) and “Customer” as the ID for the Join. Both return the same errors. DashAccount is a variable named elsewhere in the script.

    I know this is probably a simple fix but I can’t get my head around it.

    AGMNS

    var TRfilterExpression = [[‘custrecord_cr_adultelectrodeexpdate’, ‘on’, ‘tomorrow’],’AND’,[‘CUSTRECORD_CR_CUSTOMERNAME1.custentity_cust_corp_ dash_account’,’contains’,DashAccount],];

    OR

    var filter = new Array();

    filter[0] = new nlobjSearchFilter(‘custrecord_cr_adultelectrodeexp date’,null,’on’,’tomorrow’);

    filter[1] = new nlobjSearchFilter(‘custentity_cust_corp_dash_accou nt’,’CUSTOMER’,’contains’,DashAccount);
    This is a cached copy. Click here to see the original post.

  • #6024

    david.smith

    I know I sometime sound like a broken record to those that are regulars on the forum. However, if you can crate a saved search to do what you want you can output the saved search as script using this plugin:

    https://chrome.google.com/webstore/d…epdmfaihdokglp

    I’m going to assume your custentity_cust_corp_dash_account field is a text field because you’re using “contains”. And your CUSTRECORD_CR_CUSTOMERNAME1 is a select of list/record customer.

    I don’t see anything wrong with your filter but you do have an extra comma in your expressions.

  • #6025

    AGMNS

    Thanks David, I’ll definitely be using the plug in in the future. Interesting when I create the saved search I choose ‘is” withing the SS Criteria for the “custentity_cust_corp_ dash_account'” and when I export it using the plug in the filter changes to “anyof”

    GOTTA love NS.

    Thanks for the assistance

    AGMNS


    david.smith replied on 10/27/2016, 03:37 PM: Show us your final expression…

  • #6026

    AGMNS

    Here’s the final expression. BTW, ignore what I said about “anyof” I realized it was correct if you7 look past the “is” in the SS Criteria.

    IT’s unfortunate that you can’t search for the text value of custentity_cust_corp_ dash_account’. It must be the numeric value of record ID.

    Code:
    var customrecord_cr_aedinfoSearch = nlapiSearchRecord(“customrecord_cr_aedinfo”,null,
    [
    [“custrecord_cr_adultelectrodeexpdate”,”on”,”tomorrow”],
    “AND”,
    [“custrecord_cr_customername1.custentity_cust_corp_dash_account”,”anyof”,”1″]
    ],
    [
    new nlobjSearchColumn(“name”,null,null).setSort(false),
    new nlobjSearchColumn(“id”,null,null),
    new nlobjSearchColumn(“custrecord_cr_aed_model_1”,null,null),
    new nlobjSearchColumn(“custrecord_cr_aed_customname”,null,null)
    ]
    );

    AGMNS

  • #6027

    dustinh

    Originally posted by david.smith

    View Post

    I know I sometime sound like a broken record to those that are regulars on the forum. However, if you can crate a saved search to do what you want you can output the saved search as script using this plugin:

    https://chrome.google.com/webstore/d…epdmfaihdokglp

    I, for one, have never seen this so I appreciate stumbling across it just now. Thanks for that.

You must be logged in to reply to this topic.