I am attempting to search for a NetSuite Vendor (which may or may not exist in NetSuite) with the NetSuite API; however, the only piece of information I have about the Vendor is the externalId. My goal is to query NetSuite for the Vendor with the given externalId and if the Vendor exists, use it in a subsequent API call. If the Vendor doesn't exist, I'll create it and use the vendor I've just created in the subsequent API call.
Despite my searches I have not been able to find a way to search NetSuite for a record by externalId (I've found many ways to search by a Field; however I haven't found a way to search by an Attribute i.e. externalId).
Any help is appreciated.
NetSuite External ID (commonly referenced as externalid) is a means for creating a unique record ID independent of NetSuite's auto-generated Internal ID (internalid). It is most commonly used when you seek to produce an integration between NetSuite and a third-party application.
Yes, you can update external IDs through import. Let us know how did you do this, so we can helps identify the mistake. I must have done something incorrect as I just did it again and it worked. I simply imported the internal and updated the external ID.
Go to Home > Set Preferences > General > Defaults and check the box for Show Internal IDs if it hasn't already been checked.
After further research and a little help, I've figured out how to search by externalId. Hopefully this is useful for someone in the future:
Using php: Create a new GetRequest() object and a new RecordRef() object set the RecordRef's externalId to the desired external ID set the RecordRef's type to "vendor" set the GetRequest's baseRef to the RecordRef you've just created using the NetSuite client execute the get() method passing the the GetRequest() object created previously. The get() method will return a GetResponse() containing information about your search (and the object if it exists).
$getRequest = new \NetSuite\WebServices\GetRequest();
$recordRef = new \NetSuite\WebServices\RecordRef();
$recordRef->externalId = "theExternalIdGoesHere";
$recordRef->type = "vendor";
$getRequest->baseRef = $recordRef;
$response = $client->get($getRequest);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With