March 20th, 2023
The NetSuite PHP Toolkit is surprisingly fully featured but not very well documented.
This will be the first of several short snippets I post as I work with it.
This snippet fetches an item record from NetSuite given its internal ID.
<?php require_once '../PHPToolkit/NetSuiteService.php'; $service = new NetSuiteService(); $request = new GetRequest() $request->baseRef = new RecordRef(); $request->baseRef->internalId = "INTERNAL_ID_HERE"; $request->baseRef->type = "inventoryItem"; $getResponse = $service->get($request); if (!$getResponse->readResponse->status->isSuccess) { echo "Failed to get item"; } else { $item = $getResponse->readResponse->record; echo "Item Details:"; echo "<pre>"; var_dump($item); echo "</pre>"; } ?>
Make sure your NSConfig.php file is set up before doing this and you should see the results of your query returned.