BOI PO_PurchaseOrder creation.

SOLVED

Background: We're using the C# NuGet package.

When I have a session object (Sage100.ObjectManagement.MasSession), I'm able to do the following (though, actual creation inevitably fails because of needed line items).

var createObject = session.CreateObject<IMasBusinessObject>("PO_PurchaseOrder_bus", "PO_PurchaseOrder_ui", "P/O");
// SKIP VERBOSITY.
.......
createObject.Write();

----------------------------------------------

However, when attempting to do the following, the CreateObject fails immediately saying that the PO_PurchaseOrder_bus object does not exist. Exact error: KeyNotFoundException: The given key 'PO_PurchaseOrder_Bus' was not present in the dictionary.

var createObject = session.CreateObject<ILineEntry>("PO_PurchaseOrder_bus", "PO_PurchaseOrder_ui", "P/O");

----------------------------------------------

Any ideas? After looking at the documentation (and through just plain investigation), you can't create the PO_PurchaseOrderHeader record because you need line items... thus, the ILineEntry noted in the failing line above.

The above methodology that doesn't work on PO_PurchaseOrder_bus works just fine for invoices (which should follow a similar methodology, AR_Invoice_Bus).