I have a C# tool that I wrote to sync orders from a DB to QB, and every step has been a giant pain.
I'm trying to create the line items that we have in our DB in QB so I can attach the invoice items correctly, but our system allows sales staff to enter custom words, so I can't just add all the possible line items to QB through the QB interface.
I have this piece of code here
IMsgSetRequest AddItemRequestMsgSet = sessionManager.CreateMsgSetRequest("US", 8, 0);
AddItemRequestMsgSet.Attributes.OnError = ENRqOnError.roeContinue;
IItemServiceAdd itemAddRq = AddItemRequestMsgSet.AppendItemServiceAddRq();
itemAddRq.Name.SetValue(Item);
// itemAddRq.ORSalesPurchase.
IMsgSetResponse ItemAddResponseMsgSet = sessionManager.DoRequests(AddItemRequestMsgSet);
IResponse ItemAddResponse = ItemAddResponseMsgSet.ResponseList.GetAt(0);
But this is throwing an error that:
ORSalesPurchase: required field is missing
I haven't the slightest idea of what that means, and for the life of me I can't find anything about ORSalesPurchase
or IItemServiceAdd
elsewhere on the Internet, including their docs.
I can tell with Visual Studio's autocomplete that itemAddRq.ORSalesPurchase
has a bunch of options, but I haven't been able to infer from that what QB is asking for.
What are the required fields for adding a service item to QB?
And if someone can point me to where this is in their docs that would be extra wonderful:)
Stack trace:
System.Runtime.InteropServices.COMException (0x80040307): ItemServiceAdd ORSalesPurchase: required field is missing End of ItemServiceAdd
at QBFC12Lib.IQBSessionManager.DoRequests(IMsgSetRequest request)
at SterlingQBExport.Form1.CheckNewInvoices(Object source, ElapsedEventArgs e) in C:\Users\brian\Documents\Visual Studio 2015\Projects\SterlingQBExport\SterlingQBExport\Form1.cs:line 537