This topic contains 3 replies, has 0 voices, and was last updated by kentroylance 7 years, 6 months ago.

  • Author
    Posts
  • #5567 Score: 0

    kentroylance
    • Contributions: 0
    • Level 1

    Currently, I have code where I search a contact for a customer that works great! Works as expected:

    var filters = [[‘contact.internalid’, ‘is’, input.id], ‘and’, [sortField, ‘onOrAfter’, today], ‘and’, [‘entitystatus’, ‘anyof’, leadStatusCodes]];

    When I try to use the same code to search a contact for an opportunity, it returns nothing. I verified that this search works in the search tool. In the search tool the filter shows: Contact : Internal ID. Unless I am mistaken, I thought contact.internalid was the same thing as Contact : Internal ID. Is there a way to get the actual field or source from the search tool. https://system.na2.netsuite.com/app/…prtnty&whence=

    var filters = [[‘contact.internalid’, ‘is’, input.id], ‘and’, [sortField, ‘onOrAfter’, today], ‘and’, [‘entitystatus’, ‘anyof’, opportunityStatusCodes]];

    I am using this filter with nlapiCreateSearch.

    var search = nlapiCreateSearch(‘opportunity’, filters, columns);

    var resultSet = search.runSearch();

    I would appreciate any help on this.

    Kent
    This is a cached copy. Click here to see the original post.

  • #5568 Score: 0

    david.smith
    • Contributions: 0
    • Level 1

    Code:
    var contactSearch = nlapiSearchRecord(“contact”,null,
    [
    [“opportunity.status”,”anyof”,”C”], // Closed Won
    “AND”,
    [“opportunity.entitystatus”,”anyof”,”13″,”8″,”11″], // op status any of Closed Won, In Discussion, In Negotiation
    “AND”,
    [“internalid”,”anyof”,”1011″] // contact internalid
    ],
    [
    new nlobjSearchColumn(“tranid”,”opportunity”,null),
    new nlobjSearchColumn(“entity”,”opportunity”,null),
    new nlobjSearchColumn(“entityid”,null,null).setSort(false),
    new nlobjSearchColumn(“email”,null,null),
    new nlobjSearchColumn(“phone”,null,null),
    new nlobjSearchColumn(“company”,null,null)
    ]
    );


    nic kcd replied on 02/15/2017, 08:15 PM: I second that! The NetSuite Search Export is an amazing tool. I also like the NetSuite Show Field Ids extension! Thanks david.smith

  • #5569 Score: 0

    kentroylance
    • Contributions: 0
    • Level 1

    first of all, thanks for the feedback, but I still can’t get it to work. I also really need this to work with nlapiCreateSearch, since I need to be able to limit the rows by page. I also tried to use the plugin and I am getting Export as script not supported.

    “This search type is not supported by SuiteScript.” I am using Chrome Version 55.0.2883.87 m (64-bit)

    Please refer to this page in SuiteAnswers for more information.

    SuiteScript Supported Records


    david.smith replied on 02/02/2017, 11:54 AM: You have to save the search before the plugin will work. It’s based on a “saved search” and uses the nlapiLoadSearch to generate the code. What record are you trying to search on?

    The filters and columns are the same for both commands.

  • #5570 Score: 0

    kentroylance
    • Contributions: 0
    • Level 1

    Thanks, that was the ticket. By the way, that plugin is very handy, and so thanks for sharing it.

You must be logged in to reply to this topic.