Create customer order in C# using IDO with NestedUpdates to also populate lines.

I'm trying to create sales orders using the /IDORequestService/ido/update/{ido} web service interface. I'm populating the order header IDO and also including 'NestedUpdates' for the line item data. The system responds with a successful response. The order header has been created, but the lines are not there. No error messages. Any ideas?

I'm trying to use the nested updates so that the whole order is created inside a transaction.

Trimmed code looks like this:

IDOUpdateItem idoItem = new IDOUpdateItem
Action = UpdateAction.Insert,
ItemID = "PBT=[SLCoAlls]",
UpdateLocking = UpdateLocking.Property

idoItem.Properties.Add(new IDOUpdateProperty("CoNum", "H000000001", true));
idoItem.Properties.Add(new IDOUpdateProperty("SiteRef", "Default", true));
idoItem.Properties.Add(new IDOUpdateProperty("CoAllCurrCode", "USD", true));
idoItem.Properties.Add(new IDOUpdateProperty("CustPo", "PO-Test", true));
idoItem.Properties.Add(new IDOUpdateProperty("CustNum", "CustNumber", true));
idoItem.Properties.Add(new IDOUpdateProperty("CustSeq", 0, true));

IDOUpdateItem lineData = new IDOUpdateItem(UpdateAction.Insert);
lineData.Properties.Add(new IDOUpdateProperty("CoNum", "H000000001", true));
lineData.Properties.Add(new IDOUpdateProperty("SiteRef", "Default", true));
lineData.Properties.Add(new IDOUpdateProperty("Item", "ItemIdValue", true));
lineData.Properties.Add(new IDOUpdateProperty("UM", "EA", true));
lineData.Properties.Add(new IDOUpdateProperty("QtyOrdered", 3, true));

IDOUpdateItems lines = new IDOUpdateItems();

UpdateCollectionRequestData linesData = new UpdateCollectionRequestData
IDOName = "SLCoitemAlls",
RefreshAfterUpdate = true,
Items = lines

linesData.SetLinkBy("CoNum", "CoNum", "SiteRef", "SiteRef");



UpdateCollectionRequest request = new UpdateCollectionRequest { Changes = listUpdateItems };
string contentStr = JsonConvert.SerializeObject( request );

//Console.WriteLine( contentStr );

HttpResponseMessage response = client.PostAsync(requestUrl.ToString(), new StringContent(contentStr, Encoding.UTF8, "application/json")).Result;

Parents Reply
  • yes, I can call and create a header and then make a second call to create line items. The problem is that leaves it wide open to problems if something goes down between those two calls. other cloud system APIs allow for that to occur in a single web service call with both header and detail records populated.

No Data