Vishal Chaudhari
10/28/2025, 2:41 PMCeligo AI
10/28/2025, 2:41 PMAI generated answer (using internal Slack threads):Based on the conversations, it seems like the issue is related to the creation of an Item Fulfillment from a Sales Order using the PHPToolkit. The error message "INSUFFICIENT_PERMISSION" indicates that there might be a problem with the permissions or the way the inventory assignment is being set. Here is a sample code provided in the thread that might help:
php
$service = new NetSuiteService();
$salesOrderInternalID = "330536";
$reference = new InitializeRef();
$reference->type = InitializeRefType::salesOrder;
$reference->internalId = $salesOrderInternalID;
$record = new InitializeRecord();
$record->type = InitializeType::itemFulfillment;
$record->reference = $reference;
$request = new InitializeRequest();
$request->initializeRecord = $record;
$initResponse = $service->initialize($request);
if (!$initResponse->readResponse->status->isSuccess) {
echo "INIT ERROR";
exit();
}
$itemFulfillment = $initResponse->readResponse->record;
foreach($itemFulfillment->itemList->item as $item) {
$inventoryAssignment = new InventoryAssignment();
$inventoryAssignment->quantity = 9;
$inventoryAssignment->receiptInventoryNumber = "011546";
$inventoryAssignmentList = new InventoryAssignmentList();
$inventoryAssignmentList->inventoryAssignment = $inventoryAssignment;
$inventoryDetail = new InventoryDetail();
$inventoryDetail->inventoryAssignmentList = $inventoryAssignmentList;
$item->inventoryDetail = $inventoryDetail;
}
$addRequest = new AddRequest();
$addRequest->record = $itemFulfillment;
$addResponse = $service->add($addRequest);
if (!$addResponse->writeResponse->status->isSuccess) {
echo "ADD ERROR";
exit();
}
$fulfillmentInternalId = $addResponse->writeResponse->baseRef->internalId;
echo "Item Fulfillment created with internal ID: " . $fulfillmentInternalId;
This code initializes a new Item Fulfillment from a Sales Order, sets the inventory assignment, and then attempts to add the new Item Fulfillment. If the operation is not successful, it outputs an error message.
However, it's important to note that the error message you're seeing might be due to a lack of permissions, a disabled feature, or a field that is read-only or only available when a record is created or updated. You might need to check your permissions or the way you're setting the inventory assignment.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
10/28/2025, 2:41 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.849487305
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.84161377
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.834777832
Celigo AI
10/28/2025, 2:41 PM