Paul_s
07/18/2023, 1:14 PM["code"]=>
string(23) "INSUFFICIENT_PERMISSION"
["message"]=>
string(292) "You do not have permissions to set a value for element inventoryassignment.receiptinventorynumber due to one of the following reasons: 1) The field is read-only; 2) An associated feature is disabled; 3) The field is available either when a record is created or updated, but not in both cases."
As far as I can see all permissions are fine, I have been able to do the fulfilment using this role via the UI, Given the absolute lack of documentation on the toolkit it's a little tricky to guarantee my code, but attached below. Hopefully someone can see the issue
$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);
//vd($initResponse);
if (!$initResponse->readResponse->status->isSuccess) {
echo "INIT ERROR";
exit();
}
$itemFulfillment = $initResponse->readResponse->record;
foreach($itemFulfillment->itemList->item as $item) {
//$lineItemId = $item->item->internalId;
$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);
//vd($addResponse);
if (!$addResponse->writeResponse->status->isSuccess) {
echo "ADD ERROR";
exit();
}
$fulfillmentInternalId = $addResponse->writeResponse->baseRef->internalId;
echo "Item Fulfillment created with internal ID: " . $fulfillmentInternalId;
battk
07/18/2023, 1:17 PMbattk
07/18/2023, 1:18 PMPaul_s
07/18/2023, 1:32 PMbattk
07/18/2023, 1:46 PMPaul_s
07/18/2023, 1:50 PMbattk
07/18/2023, 1:51 PMbattk
07/18/2023, 1:51 PMbattk
07/18/2023, 1:52 PMPaul_s
07/18/2023, 1:54 PMbattk
07/18/2023, 1:56 PMPaul_s
07/18/2023, 1:56 PM["issueInventoryNumber"]=>
object(RecordRef)#33 (4) {
["name"]=>
string(7) "2942206"
["internalId"]=>
string(4) "8659"
["externalId"]=>
NULL
["type"]=>
NULL
}
battk
07/18/2023, 1:58 PMPaul_s
07/18/2023, 1:59 PMobject(InventoryAssignment)#32 (10) {
["internalId"]=>
string(6) "384752"
["issueInventoryNumber"]=>
object(RecordRef)#33 (4) {
["name"]=>
string(7) "2942206"
["internalId"]=>
string(4) "8659"
["externalId"]=>
NULL
["type"]=>
NULL
}
["receiptInventoryNumber"]=>
NULL
["binNumber"]=>
NULL
["toBinNumber"]=>
NULL
["quantity"]=>
float(1)
["expirationDate"]=>
string(29) "2025-11-06T16:00:00.000-08:00"
["quantityAvailable"]=>
float(128)
["inventoryStatus"]=>
NULL
["toInventoryStatus"]=>
NULL
}
battk
07/18/2023, 2:00 PMbattk
07/18/2023, 2:01 PM$inventoryAssignment = new InventoryAssignment();
Paul_s
07/18/2023, 2:02 PMbattk
07/18/2023, 2:02 PMPaul_s
07/18/2023, 2:06 PMbattk
07/18/2023, 2:12 PMbattk
07/18/2023, 2:14 PMbattk
07/18/2023, 2:15 PMPaul_s
07/18/2023, 2:16 PMbattk
07/18/2023, 2:18 PMbattk
07/18/2023, 2:18 PMbattk
07/18/2023, 2:19 PMPaul_s
07/18/2023, 2:20 PMbattk
07/18/2023, 2:21 PMPaul_s
07/18/2023, 2:21 PMbattk
07/18/2023, 2:21 PMbattk
07/18/2023, 2:22 PMbattk
07/18/2023, 2:23 PMbattk
07/18/2023, 2:23 PMPaul_s
07/18/2023, 2:24 PMPaul_s
07/18/2023, 2:25 PM