NetSuite PHP Toolkit – Get Internal ID from SKU

June 15th, 2023

I’ve been working a lot with NetSuite’s PHP Toolkit.

While NetSuite works with “internal ids”, most merchants likely work with SKUs.

To get the Internal ID from the SKU, a simple call is needed.

require_once '../PHPToolkit/NetSuiteService.php';

$service = new NetSuiteService();

$service->setSearchPreferences(false, 20);

$itemSearchField = new SearchStringField();
$itemSearchField->operator = "is";
$itemSearchField->searchValue = "EBGOAIRRBLK82"; // Your SKU Here

$search = new ItemSearchBasic();
$search->itemId = $itemSearchField;

$request = new SearchRequest();
$request->searchRecord = $search;

$searchResponse = $service->search($request);

if (!$searchResponse->searchResult->status->isSuccess) {
    echo "No results found";
} else {
    echo "<pre>";
    echo "Success! Records Found: " . $searchResponse->searchResult->totalRecords;
    echo "First Record Internal ID: ";
    print_r($searchResponse->searchResult->recordList->record[0]->internalId); // Get just the first result
    echo "</pre>";


Leave a Reply

Your email address will not be published. Required fields are marked *