Acumatica API Error when creating a Inventory Receipts API calls - acumatica

Good day
I am creating a SOAP contract base connection to Acumatica.
I am getting an error: "System.ArgumentNullException: Value cannot be null."
I am not sure why I am getting the error.
Here is my code
using (var soapClient = new DefaultSoapClient())
{
try
{
soapClient.Login();
InventoryReceipt NewinventoryReceipt = new InventoryReceipt
{
ReferenceNbr = new StringValue { Value = "<NEW>" },
Hold = new BooleanValue { Value = true },
Date = new DateTimeValue { Value = DateTime.Now },
PostPeriod = new StringValue { Value = DateTime.Now.ToString("DD-yyyy") },
TransferNbr = new StringValue { Value = "" },
//External Ref
Description = new StringValue { Value = "" },
Details = new InventoryReceiptDetail[]
{
new InventoryReceiptDetail
{
//branch
InventoryID = new StringValue{Value = "NIS777"},
WarehouseID = new StringValue{Value = "FBTZEST"},
Location = new StringValue {Value = "BULK"},
Qty = new DecimalValue{Value = 1},
UOM = new StringValue{Value = "PALLET"},
UnitCost = new DecimalValue{Value = 91},
ExtCost = new DecimalValue{Value = 91},
LotSerialNbr = new StringValue{Value = "PLN12345"},
ExpirationDate = new DateTimeValue{Value = DateTime.Now},
// ReasonCode
Description = new StringValue{Value = ""}
}
},
};
InventoryReceipt putInventoryReceipt = (InventoryReceipt)soapClient.Put(NewinventoryReceipt);
}
catch (Exception ex)
{
soapClient.Logout();
throw;
}
finally
{
soapClient.Logout();
}
soapClient.Logout();
}
Console.ReadLine();
}
Is there any way to see what is null or what I am missing to post this data?

Have you tried manually entering the data into the UI? The Validation on the web service should be the same as the UI, so you might get more info from the UI. You have a lot of dependent values here since you're referencing a specific Lot perhaps a value is missing. Other than that, you might try adding Project = X.

Related

How to create attributes on a Service Order through Web Services

I had to create my own Web Service Endpoint for Service Orders. Here is the WSDL: https://imagineersllc.acumatica.com/(W(7))/entity/PileraAPI/19.100.0122?wsdl&company=Imagineers%20LLC%20-%20Prototype I added Attributes to it following an example I found under Stock Items in the Default Endpoint.
I added attributes to the Service Order type and when I try to populate the attributes in my API they remain blank. The Service Order gets created just fine it just does not populate the attributes.
I've tried renaming the attributes and using the code vs the description in my code.
string sServiceOrderType = "MRO"; // Only type supported
string sCustomer = "1003";
string sBranchLocation = "PROPMGMT"; // Only location available
string sWorkflowStage = "ACKNOWLEDGED";
DateTime dDate = DateTime.Parse("7/1/2019");
string sExternalReference = "WO-2345";
string sDescription = "Service Order from Pilera API";
bool bOverride = true; // Used to make Contact and Address editable
string sCompanyName = "DSD Business Systems";
string sAttention = "John Wiles";
string sPhone = "(858) 550-5900";
string sEmail = "johnw#dsdinc.com";
string sAddressLine1 = "1225 Rosemarie Way";
string sAddressLine2 = "";
string sCity = "Chesapeake";
string sState = "VA";
string sPostalCode = "23322";
DateTime dPromisedDate = DateTime.Parse("7/21/2019");
string sSeverity = "Low";
string sPriority = "High";
string sComment = "Comment created by API";
bool bHold = true;
string sCategory = "GENERALREPAIR";
string sCommunity = "Deerfield Condominium Assoc.";
string sContact = "Annamma George";
string sContactPhone = "860-656-6603";
string sContactLocation = "268 Richard Street #1 Newington, CT 06111";
ServiceOrders ServiceOrdersToBeCreated = new ServiceOrders
{
ServiceOrderType = new StringValue { Value = sServiceOrderType },
Customer = new StringValue { Value = sCustomer },
BranchLocation = new StringValue { Value = sBranchLocation },
WorkflowStage = new StringValue { Value = sWorkflowStage },
Date = new DateTimeValue { Value = dDate },
ExternalReference = new StringValue { Value = sExternalReference },
Description = new StringValue { Value = sDescription },
Hold = new BooleanValue { Value = bHold },
PromisedDate = new DateTimeValue { Value = dPromisedDate },
Severity = new StringValue { Value = sSeverity },
Priority = new StringValue { Value = sPriority },
Category = new StringValue { Value = sCategory },
Override = new BooleanValue { Value = bOverride },
CompanyName = new StringValue { Value = sCompanyName },
Attention = new StringValue { Value = sAttention },
Phone = new StringValue { Value = sPhone },
Email = new StringValue { Value = sEmail },
AddressLine1 = new StringValue { Value = sAddressLine1 },
AddressLine2 = new StringValue { Value = sAddressLine2 },
City = new StringValue { Value = sCity },
State = new StringValue { Value = sState },
PostalCode = new StringValue { Value = sPostalCode },
Comment = new StringValue { Value = sComment },
Attributes = new[]
{
new AttributeValue
{
AttributeID = new StringValue { Value = "Community" },
Value = new StringValue { Value = sCommunity }
},
new AttributeValue
{
AttributeID = new StringValue { Value = "Contact" },
Value = new StringValue { Value = sContact }
},
new AttributeValue
{
AttributeID = new StringValue { Value = "Phone" },
Value = new StringValue { Value = sContactPhone }
},
new AttributeValue
{
AttributeID = new StringValue { Value = "Location" },
Value = new StringValue { Value = sContactLocation }
}
}
};
ServiceOrders newServiceOrder = (ServiceOrders)soapClient.Put(ServiceOrdersToBeCreated);
Service Order is created without attributes. No error messages received.
Here is what Support provided:
try
{
ServiceOrders newServiceOrder = (ServiceOrders)client.Put(ServiceOrdersToBeCreated);
List<AttributeValue> attrList = new List<AttributeValue>();
foreach (AttributeValue attrVal in newServiceOrder.Attributes)
{
AttributeValue attr = new AttributeValue();
attr.ID = attrVal.ID;
switch(attrVal.AttributeID.Value)
{
case "Community":
attr.Value = new StringValue { Value = sCommunity };
break;
case "Contact":
attr.Value = new StringValue { Value = sContact };
break;
case "Phone":
attr.Value = new StringValue { Value = sContactPhone };
break;
case "Location":
attr.Value = new StringValue { Value = sContactLocation };
break;
default:
Console.WriteLine("Attribute Not Found!");
break;
}
attrList.Add(attr);
}
newServiceOrder.Attributes = attrList.ToArray();
newServiceOrder = (ServiceOrders)client.Put(newServiceOrder);
}

Closing Case in Acumatica through API

I want to close the case in Partners Portal remotely using Web API, whenever I close the case in my (client) side. I was able to implement the code but ran into below issue.
It is changing the status and resolution of the case in Partners Portal but Close Case button is enabled and it is visible in My Open Case bucket. Please let me know if I can close the case remotely using Web API or if I am missing anything.
protected virtual void CRCase_RowPersisting(PXCache cache, PXRowPersistingEventArgs e)
{
var caseRow = (CRCase)e.Row;
if (caseRow != null)
{
if (caseRow.Status == "C") // Closed
{
string cloud9CaseCD = null;
cloud9CaseCD = CRCaseForCreate.Current.CaseCD;
string acumaticaCaseCD = string.Empty;
CSAnswers aCCaseNoAttribute = PXSelect<CSAnswers,
Where<CSAnswers.refNoteID, Equal<Required<CSAnswers.refNoteID>>,
And<CSAnswers.attributeID, Equal<Required<CSAnswers.attributeID>>>>>.Select(new PXGraph(), CRCaseForCreate.Current.NoteID, "ACCASENO");
if (aCCaseNoAttribute != null)
{
acumaticaCaseCD = aCCaseNoAttribute.Value;
if(!string.IsNullOrEmpty(acumaticaCaseCD))
{
SP203000WS.Screen context = new SP203000WS.Screen();
context.CookieContainer = new System.Net.CookieContainer();
context.AllowAutoRedirect = true;
context.EnableDecompression = true;
context.Timeout = 1000000;
context.Url = "https://sso.acumatica.com/Soap/SP203000.asmx";
PartnerPortalCreds loginCreds = GetCreds();
string username = loginCreds.PARTPRTUSE;
string password = loginCreds.PARTPRTPAS;
SP203000WS.LoginResult result = context.Login(username, password);
SP203000WS.Content CR306000 = context.GetSchema();
context.Clear();
SP203000WS.Content[] CR306000Content = context.Submit
(
new SP203000WS.Command[]
{
new SP203000WS.Value
{
Value = acumaticaCaseCD,
LinkedCommand = CR306000.Case.CaseID
},
new SP203000WS.Value
{
Value = "C",
LinkedCommand = new SP203000WS.Field { FieldName="Status", ObjectName="Case"}
},
new SP203000WS.Value
{
Value = "RD",
LinkedCommand = new SP203000WS.Field { FieldName="Resolution", ObjectName="Case"}
},
CR306000.Actions.Submit,
CR306000.Case.CaseID
}
);
context.Logout();
}
}
}
}
}
Tried below code using CloseCase Action: -
protected virtual void CRCase_RowPersisting(PXCache cache, PXRowPersistingEventArgs e)
{
var caseRow = (CRCase)e.Row;
if (caseRow != null)
{
if (caseRow.Status == "C") // Closed
{
string cloud9CaseCD = null;
cloud9CaseCD = CRCaseForCreate.Current.CaseCD;
string acumaticaCaseCD = string.Empty;
CSAnswers aCCaseNoAttribute = PXSelect<CSAnswers,
Where<CSAnswers.refNoteID, Equal<Required<CSAnswers.refNoteID>>,
And<CSAnswers.attributeID, Equal<Required<CSAnswers.attributeID>>>>>.Select(new PXGraph(), CRCaseForCreate.Current.NoteID, "ACCASENO");
if (aCCaseNoAttribute != null)
{
acumaticaCaseCD = aCCaseNoAttribute.Value;
if (!string.IsNullOrEmpty(acumaticaCaseCD))
{
SP203010WS.Screen context = new SP203010WS.Screen();
context.CookieContainer = new System.Net.CookieContainer();
context.AllowAutoRedirect = true;
context.EnableDecompression = true;
context.Timeout = 1000000;
context.Url = "https://sso.acumatica.com/Soap/SP203010.asmx";
PartnerPortalCreds loginCreds = GetCreds();
string username = loginCreds.PARTPRTUSE;
string password = loginCreds.PARTPRTPAS;
SP203010WS.LoginResult result = context.Login(username, password);
SP203010WS.Content CR306000 = context.GetSchema();
context.Clear();
var commands1 = new SP203010WS.Command[]
{
new SP203010WS.Value
{
Value = acumaticaCaseCD,
LinkedCommand = CR306000.Case.CaseID
},
new SP203010WS.Value
{
Value = "Yes",
LinkedCommand = CR306000.Case.ServiceCommands.DialogAnswer, Commit = true
},
CR306000.Actions.CloseCase
};
var data = context.Submit(commands1);
context.Logout();
}
}
}
}
}
In the below image you can see that the case is already closed but Close Case menu button is still visible.
Close Case Confirmation Dialogbox on Partners Portal. How should I answer this dialogbox programatically while closing the case using Web API.
Have you tried to invoke Close action via Web API instead of changing values of the Status and Resolution fields? As far as I know, Close button on the Partner Portal updates support case Status to Open and Reason to Pending Closure. Then it's up to support personnel to manually close the case.
Finally found the solution. Updated the code for CloseCase (second code snippet). This will mark the case as Pending Closure in Partners Portal.

How to specify fields for detail records with Acumatica ReturnBehavior

I'm trying to use the Acumatica API to return a list of Sales Order and Sales Order Details, while limiting the fields returned.
So far, I have :
SalesOrder filter = new SalesOrder
{
//Filter the SOs returned
OrderType = new AcumaticaOpticsExt.StringValue { Value = salesOrder.Split('/').First() },
OrderNbr = new AcumaticaOpticsExt.StringValue { Value = salesOrder.Split('/').Last() },
//Specify return behavior
ReturnBehavior = ReturnBehavior.OnlySpecified,
//Specify the fields to be returned on the SO
Hold = new BooleanReturn(),
CustomerName = new StringReturn(),
SchedShipment = new DateTimeReturn(),
QtyAllocatedM = new DecimalReturn(),
QtyAllocatedNotCompletedM = new DecimalReturn(),
//And from the SO Line Detail
};
It's not clear how I can specify the fields from the Details and I haven't found any multi-level uses in the documentation.
Does anyone have an example?
Here is an example that works for me :
SalesOrder so = new SalesOrder
{
ReturnBehavior = ReturnBehavior.OnlySpecified,
OrderType = new StringSearch { Value = "SO", Condition = StringCondition.Equal },
OrderNbr = new StringSearch { Value = "001253", Condition = StringCondition.Equal },
Details = new SalesOrderDetail[]
{
new SalesOrderDetail
{
ReturnBehavior = ReturnBehavior.OnlySpecified,
InventoryID = new StringReturn(),
LineNbr = new IntReturn(),
UOM = new StringReturn(),
UnitPrice = new DecimalReturn(),
Quantity = new DecimalReturn()
}
}
};
You just have to define the array of detail items, in the first one define the return behavior level that you want and if it applies the field(s) that you want to be returned.

Acumatica change Shipping Terms on Sales Order creation

I'm using Acumatica's contract based API to create sales order from an ASP.net application. I need to update the "Shipping Terms" field under the "Shipping Settings" tab on a Sales Order when I create it (see below), but I can not find the property to use on the ASP.net objects that are provided through the contract based API. How would I accomplish this?
Here is my current code for how I create the sales order:
using (DefaultSoapClient client = new DefaultSoapClient(binding, address))
{
//Sales order data
string customerID = "CUST1234;
string orderDescription = "Automated Order";
string customerOrder = "TEST";
var orderDetails = new List<SalesOrderDetail>();
foreach(var lineItem in order.line_items)
{
orderDetails.Add(new SalesOrderDetail {
InventoryID = new StringValue { Value = lineItem.sku },
Quantity = new DecimalValue { Value = lineItem.quantity },
UnitPrice = new DecimalValue { Value = Decimal.Parse(lineItem.price) }, //TODO this should only be done for MHR owned sites
UOM = new StringValue { Value = "EACH" },
});
}
//Specify the values of a new sales order
SalesOrder orderToBeCreated = new SalesOrder
{
OrderType = new StringValue { Value = "SO" },
CustomerID = new StringValue { Value = customerID },
Description = new StringValue { Value = orderDescription },
CustomerOrder = new StringValue { Value = customerOrder },
ExternalReference = new StringValue { Value = order.order_number.ToString() },
Details = orderDetails.ToArray<SalesOrderDetail>(),
ShippingAddressOverride = new BooleanValue { Value = true },
ShippingContactOverride = new BooleanValue { Value = true },
ShippingContact = new Contact()
{
DisplayName = new StringValue { Value = order.shipping_address.first_name + " " + order.shipping_address.last_name },
FirstName = new StringValue { Value = order.shipping_address.first_name },
LastName = new StringValue { Value = order.shipping_address.last_name },
Address = new Address()
{
AddressLine1 = new StringValue { Value = order.shipping_address.address_1 },
AddressLine2 = new StringValue { Value = order.shipping_address.address_2 },
City = new StringValue { Value = order.shipping_address.city },
State = new StringValue { Value = order.shipping_address.state },
Country = new StringValue { Value = order.shipping_address.country },
PostalCode = new StringValue { Value = order.shipping_address.postcode }
}
},
};
client.Login(_acumaticaUid, _acumaticaPwd, _acumaticaCompany, null, null);
//Create a sales order with the specified values
try
{
SalesOrder newOrder = (SalesOrder)await client.PutAsync(orderToBeCreated);
client.Logout();
return newOrder;
}
catch (Exception e)
{
//order addition to Acumatica failed, update the order status in Woo Commerce
client.Logout();
Console.WriteLine("Acumatica could not add specified entity: " + e);
return null;
}
}
UPDATE:
Based on PatrickChen's comment, I created a new web service endpoint in Acumatica "SalesOrderCustom", where I used all of the default fields and then added "ShippingTerms" to the list as well. I then imported that web service into my .net project (with some headache due to this issue) and was able to use the service to GET the sales order I wanted to add shipping terms to, and try to update it. The code executes ok, but after the PUT operation is done, the object is NOT updated in Acumatica and the ShippingTerms property is returned as NULL. What am I doing wrong? Code below:
public async Task<SalesOrderCustom> UpdateShippingTerms(string customerOrder, string originStore, string shippingSpeed)
{
var binding = CreateNewBinding(true, 655360000, 655360000);
var address = new EndpointAddress(ConfigurationManager.AppSettings["AcumaticaCustomUrl"]);
var soToBeFound = new SalesOrderCustom()
{
OrderType = new StringSearch { Value = "SO" },
CustomerOrder = new StringSearch { Value = customerOrder }
};
using (DefaultSoapClient client = new DefaultSoapClient(binding, address))
{
client.Login(_acumaticaUid, _acumaticaPwd, _acumaticaCompany, null, null);
try
{
var soToBeUpdated = (SalesOrderCustom) await client.GetAsync(soToBeFound);
soToBeUpdated.ShippingTerms = new StringValue { Value = "USPS 1 CLS" };
var updatedOrder = (SalesOrderCustom)await client.PutAsync(soToBeUpdated);
//ShippingTerms is still NULL on returned object even after updating the object!!! WHY???
client.Logout();
return updatedOrder;
}
catch (Exception e)
{
client.Logout();
Console.WriteLine("Acumatica could not find specified entity: " + e);
return null;
}
}
}
Starting Acumatica 6, it's possible to update any field, not included into the Default endpoint. This feature is only available for endpoints implementing system contract of the 2nd version:
Below is the sample showing how to change Shipping Terms for a Sales Order with the Default Contract-Based endpoint by working with the CustomFields collection:
using (var client = new DefaultSoapClient())
{
client.Login("admin", "123", null, null, null);
try
{
var order = new SalesOrder()
{
OrderType = new StringSearch { Value = "SO" },
OrderNbr = new StringSearch { Value = "SO003729" }
};
order = client.Get(order) as SalesOrder;
order.CustomFields = new CustomField[]
{
new CustomStringField
{
fieldName = "ShipTermsID",
viewName = "CurrentDocument",
Value = new StringValue { Value = "FLATRATE2" }
}
};
client.Put(order);
}
finally
{
client.Logout();
}
}
No issues also noticed on my end when updating Sales Order Shipping Terms with the extended Default Contract-Based endpoint on a brand new Acumatica ERP 6.1 instance:
using (var client = new DefaultSoapClient())
{
client.Login("admin", "123", null, null, null);
try
{
var order = new SalesOrder()
{
OrderType = new StringSearch { Value = "SO" },
OrderNbr = new StringSearch { Value = "SO003729" }
};
order = client.Get(order) as SalesOrder;
order.ShippingTerms = new StringValue { Value = "FLATRATE1" };
client.Put(order);
}
finally
{
client.Logout();
}
}
For reference, adding screenshot of my extended Default endpoint used to update Shipping Terms in the SalesOrder entity:
I was able to add Shipping Terms when I created a new 6.0 endpoint. The default endpoint that ships with Acumatica is not extendable.

NetSuite SuiteTalk API - Get Inventory Details

I'm using the SuiteTalk (API) service for NetSuite to retrieve a list of Assemblies. I need to load the InventoryDetails fields on the results to view the serial/lot numbers assigned to the items. This is the current code that I'm using, but the results still show those fields to come back as NULL, although I can see the other fields for the AssemblyBuild object. How do I get the inventory details (serials/lot#'s) to return on a transaction search?
public static List<AssemblyBuildResult> Get()
{
var listAssemblyBuilds = new List<AssemblyBuildResult>();
var service = Service.Context();
var ts = new TransactionSearch();
var tsb = new TransactionSearchBasic();
var sfType = new SearchEnumMultiSelectField
{
#operator = SearchEnumMultiSelectFieldOperator.anyOf,
operatorSpecified = true,
searchValue = new string[] { "_assemblyBuild" }
};
tsb.type = sfType;
ts.basic = tsb;
ts.inventoryDetailJoin = new InventoryDetailSearchBasic();
// perform the search
var response = service.search(ts);
response.pageSizeSpecified = true;
// Process response
if (response.status.isSuccess)
{
// Process the records returned in the response
// Get more records with pagination
if (response.totalRecords > 0)
{
for (var x = 1; x <= response.totalPages; x++)
{
var records = response.recordList;
foreach (var t in records)
{
var ab = (AssemblyBuild) t;
listAssemblyBuilds.Add(GetAssemblyBuildsResult(ab));
}
if (response.pageIndex < response.totalPages)
{
response = service.searchMoreWithId(response.searchId, x + 1);
}
}
}
}
// Parse and return NetSuite WorkOrder into assembly WorkOrderResult list
return listAssemblyBuilds;
}
After much pain and suffering, I was able to solve this problem with the following code:
/// <summary>
/// Returns List of AssemblyBuilds from NetSuite
/// </summary>
/// <returns></returns>
public static List<AssemblyBuildResult> Get(string id = "", bool getDetails = false)
{
// Object to populate and return results
var listAssemblyBuilds = new List<AssemblyBuildResult>();
// Initiate Service and SavedSearch (TransactionSearchAdvanced)
var service = Service.Context();
var tsa = new TransactionSearchAdvanced
{
savedSearchScriptId = "customsearch_web_assemblysearchmainlist"
};
// Filter by ID if specified
if (id != "")
{
tsa.criteria = new TransactionSearch()
{
basic = new TransactionSearchBasic()
{
internalId = new SearchMultiSelectField
{
#operator = SearchMultiSelectFieldOperator.anyOf,
operatorSpecified = true,
searchValue = new[] {
new RecordRef() {
type = RecordType.assemblyBuild,
typeSpecified = true,
internalId = id
}
}
}
}
};
}
// Construct custom columns to return
var tsr = new TransactionSearchRow();
var tsrb = new TransactionSearchRowBasic();
var orderIdCols = new SearchColumnSelectField[1];
var orderIdCol = new SearchColumnSelectField();
orderIdCols[0] = orderIdCol;
tsrb.internalId = orderIdCols;
var tranDateCols = new SearchColumnDateField[1];
var tranDateCol = new SearchColumnDateField();
tranDateCols[0] = tranDateCol;
tsrb.tranDate = tranDateCols;
var serialNumberCols = new SearchColumnStringField[1];
var serialNumberCol = new SearchColumnStringField();
serialNumberCols[0] = serialNumberCol;
tsrb.serialNumbers = serialNumberCols;
// Perform the Search
tsr.basic = tsrb;
tsa.columns = tsr;
var response = service.search(tsa);
// Process response
if (response.status.isSuccess)
{
var searchRows = response.searchRowList;
if (searchRows != null && searchRows.Length >= 1)
{
foreach (SearchRow t in searchRows)
{
var transactionRow = (TransactionSearchRow)t;
listAssemblyBuilds.Add(GetAssemblyBuildsResult(transactionRow, getDetails));
}
}
}
// Parse and return NetSuite WorkOrder into assembly WorkOrderResult list
return listAssemblyBuilds;
}
private static string GetAssemblyBuildLotNumbers(string id)
{
var service = Service.Context();
var serialNumbers = "";
var tsa = new TransactionSearchAdvanced
{
savedSearchScriptId = "customsearch_web_assemblysearchlineitems"
};
service.searchPreferences = new SearchPreferences { bodyFieldsOnly = false };
tsa.criteria = new TransactionSearch()
{
basic = new TransactionSearchBasic()
{
internalId = new SearchMultiSelectField
{
#operator = SearchMultiSelectFieldOperator.anyOf,
operatorSpecified = true,
searchValue = new[] {
new RecordRef() {
type = RecordType.assemblyBuild,
typeSpecified = true,
internalId = id
}
}
}
}
};
// Construct custom columns to return
var tsr = new TransactionSearchRow();
var tsrb = new TransactionSearchRowBasic();
var orderIdCols = new SearchColumnSelectField[1];
var orderIdCol = new SearchColumnSelectField();
orderIdCols[0] = orderIdCol;
tsrb.internalId = orderIdCols;
var serialNumberCols = new SearchColumnStringField[1];
var serialNumberCol = new SearchColumnStringField();
serialNumberCols[0] = serialNumberCol;
tsrb.serialNumbers = serialNumberCols;
tsr.basic = tsrb;
tsa.columns = tsr;
var response = service.search(tsa);
if (response.status.isSuccess)
{
var searchRows = response.searchRowList;
if (searchRows != null && searchRows.Length >= 1)
{
foreach (SearchRow t in searchRows)
{
var transactionRow = (TransactionSearchRow)t;
if (transactionRow.basic.serialNumbers != null)
{
return transactionRow.basic.serialNumbers[0].searchValue;
}
}
}
}
return serialNumbers;
}
private static AssemblyBuildResult GetAssemblyBuildsResult(TransactionSearchRow tsr, bool getDetails)
{
if (tsr != null)
{
var assemblyInfo = new AssemblyBuildResult
{
NetSuiteId = tsr.basic.internalId[0].searchValue.internalId,
ManufacturedDate = tsr.basic.tranDate[0].searchValue,
SerialNumbers = tsr.basic.serialNumbers[0].searchValue
};
// If selected, this will do additional NetSuite queries to get detailed data (slower)
if (getDetails)
{
// Look up Lot Number
assemblyInfo.LotNumber = GetAssemblyBuildLotNumbers(tsr.basic.internalId[0].searchValue.internalId);
}
return assemblyInfo;
}
return null;
}
What I learned about pulling data from NetSuite:
Using SavedSearches is the best method to pull data that doesn't automatically come through in the API objects
It is barely supported
Don't specify an ID on the SavedSearch, specify a criteria in the TransactionSearch to get one record
You will need to specify which columns to actually pull down. NetSuite doesn't just send you the data from a SavedSearch automatically
You cannot view data in a SavedSearch that contains a Grouping
In the Saved Search, use the Criteria Main Line = true/false to read data from the main record (top of UI screen), and line items (bottom of screen)

Resources