I need to reference a customer to a subsidiary in netsuite. I am using c# soap api. Is there a way to loop over all subsidiary items in netsuite in c# and select the one i need.
Asked
Active
Viewed 1,207 times
0
-
I'm not familiar with C#, but I could provide ruby code. Would that be helpful? – iloveitaly Oct 11 '16 at 17:42
-
@iloveitaly can You still provide some ruby code? :D – Jakub Kopyś Jan 16 '19 at 14:41
1 Answers
1
It would be something like this:
var sub = new SubsidiarySearchBasic();
var res = netSuiteService.search(sub);
if (res.status.isSuccess)
{
if (res.totalPages == res.pageIndex)
{
var result = res.recordList.ToList().Any() ? res.recordList.ToList().Cast<Subsidiary>().ToList() : null;
}
else
{
var resultados = res.recordList.ToList().Cast<Invoice>().ToList();
for (var i = 2; i <= res.totalPages; i++)
{
var resPages = netSuiteService.searchMoreWithId(res.searchId, i);
if (resPages.status.isSuccess)
{
resultados.AddRange(res.recordList.ToList().Cast<Invoice>().ToList());
}
}
}
}
else
{
throw new Exception(string.Join(",", res.status.statusDetail.ToList()));
}

Pedro Bustos
- 74
- 4