Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NetSuite API search by externalId

Tags:

netsuite

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.

like image 435
Colby Clark Avatar asked Jun 10 '14 15:06

Colby Clark


People also ask

What is the difference between internal ID and external ID in NetSuite?

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.

Can you update external ID in NetSuite?

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.

How do I find my internal ID for NetSuite?

Go to Home > Set Preferences > General > Defaults and check the box for Show Internal IDs if it hasn't already been checked.


1 Answers

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);
like image 183
Colby Clark Avatar answered Oct 06 '22 10:10

Colby Clark