Hi, I'm new to NetSuite and have only developed web services largely through the .NET object model.
I'm simply trying to get my first test functions working. I've done successful item searches and I'm trying to add a new order. The code runs fine but I keep getting "Could not calculate cost for the selected Realtime rate. The requested service is unavailable between the selected locations.".
As suggested by NetSuite support I've set "ignorereadonlyFields" to true (see code below) and made sure the item has a shipping cost but no joy. I also tried both 2.5 and 2.6 with the same result.
Even the simplest code snippet to place an order with the minimum required fields would work for me. Then I can figure out the rest.
Regards, Rodney
//CREATE SALES ORDER NetSuite26WS.SalesOrder so = new NetSuite26WS.SalesOrder(); if (res.status.isSuccess) { if (res.recordList != null && res.recordList.Length == 1) { NetSuite26WS.RecordRef customer = new NetSuite26WS.RecordRef(); customer.type = NetSuite26WS.RecordType.customer; customer.typeSpecified = true; System.String entID = ((NetSuite26WS.Customer) (res.recordList[0])).entityId; customer.name = entID; customer.internalId = ((NetSuite26WS.Customer) (res.recordList[0])).internalId; so.entity = customer; // set the transaction date and status so.tranDate = new System.DateTime(); so.orderStatus = NetSuite26WS.SalesOrderOrderStatus._pendingApproval; // Enter the nsKey for inventory items to be added to the SO //_out.writeLn("nPlease enter the nsKey values for INVENTORY ITEMS seperated by commas (do not enter discount or subtotal items)."); //System.String itemKeys = _out.readLn(); //System.String[] itemKeysArray = itemKeys.Split(new Char[] {','}); //ReadResponse[] readRes = getInventoryItemList(itemKeysArray); // Determine the number of valid inventory item nsKeys entered // for (int a = 0; a < readRes.Length; a++) // { // if (readRes[a].record != null) // { // vec.Add(readRes[a].record); // } } NetSuite26WS.SalesOrderItem[] salesOrderItemArray = new NetSuite26WS.SalesOrderItem[vec.Count]; //salesOrderItemArray[0] = (NetSuite26WS.SalesOrderItem)vec[0]; //salesOrderItemArray[1] = (NetSuite26WS.SalesOrderItem)vec[1]; // Create the correct sales order items and populate the // quantity for (int i = 0; i < vec.Count; i++) { if (vec[i] is NetSuite26WS.InventoryItem) { NetSuite26WS.RecordRef item = new NetSuite26WS.RecordRef(); item.type = NetSuite26WS.RecordType.inventoryItem; item.typeSpecified = true; item.internalId = ((NetSuite26WS.InventoryItem) (vec[i])).internalId; salesOrderItemArray[i] = new NetSuite26WS.SalesOrderItem(); salesOrderItemArray[i].item = item; //_out.writeLn("nPlease enter quantity for " + ((NetSuite26WS.InventoryItem) // (vec[i])).itemId); System.Double quantity = 1; //System.Double.Parse(_out.readLn()); salesOrderItemArray[i].quantity = quantity; salesOrderItemArray[i].quantitySpecified = true; } } //NetSuite26WS.SalesOrderItemList salesOrderItemList = new NetSuite26WS.SalesOrderItemList(); //( salesOrderItemArray, true); //TODO: No constructor present for two arguement. NetSuite26WS.SalesOrderItemList salesOrderItemList = new NetSuite26WS.SalesOrderItemList(); salesOrderItemList.item = salesOrderItemArray; so.itemList = salesOrderItemList; NetSuite26WS.Preferences pref = new NetSuite26WS.Preferences(); pref.ignoreReadOnlyFieldsSpecified = true; pref.ignoreReadOnlyFields = true; pref.warningAsErrorSpecified = true; pref.warningAsError = false; //NetSuite26WS.RecordRef pref = new NetSuite26WS.RecordRef(); //pref.typeSpecified = true; //pref.type = NetSuite26WS.RecordType.pr //service.add(pref); // ignoreReadOnlyFieldsSpecified = true; service.preferences = pref; // .ignoreReadOnlyFieldsSpecified = true; //service.preferences.ignoreReadOnlyFields = true; NetSuite26WS.WriteResponse writeRes = service.add(so); if (writeRes.status.isSuccess) { string str = "Sales order created successfully"; //_out.writeLn("nSales order created successfully"); } else { string str = "hiya"; //getStatusDetails(writeRes.status)"; //_out.error(getStatusDetails(writeRes.status)); } } else { string str = "Sales order is not created because 0 or more than 1 customer records found for the entityID given"; //_out.writeLn("nSales order is not created because 0 or more than 1 customer records found for the entityID given"); } } else { string str = "hiya"; //getStatusDetails(res.status); //_out.error(getStatusDetails(res.status)); }