Has anyone had success creating multiple quote/order detail lines in the QuoteDtl dataset? I’m trying to create multiple QuoteDtl lines on the quote via code, but it only seems to add one even when calling the GetNewQuoteDtl multiple times.
Here’s what I’ve tried:
Erp.Proxy.BO.QuoteImpl quote = Ice.Lib.Framework.WCFServiceSupport.CreateImpl<Erp.Proxy.BO.QuoteImpl>(session, Erp.Proxy.BO.QuoteImpl.UriPath);
Erp.BO.QuoteDataSet quoteDataset = quote.GetByID(30388);
for (int n = 1; n <= 4; n++)
{
quote.GetNewQuoteDtl(quoteDataset, 30388);
DataRow quoteDtl_xRow = quoteDataset.Tables["QuoteDtl"].Select().LastOrDefault();
quoteDtl_xRow["PartNum"] = "Part " + n;
quoteDtl_xRow["SellingExpectedQty"] = n;
quoteDtl_xRow["OrderQty"] = n;
quoteDtl_xRow["LineDesc"] = "Test Multi " + n;
quoteDtl_xRow["ProdCode"] = "AGuide";
}
quote.Update(quoteDataset);
As I step through my test code, the QuoteDtl dataset count remains at 1 even as iteration count is at 4 (the QuoteDtl count should be equal to the iteration count).
I also noticed the AddQuoteDtlRow method which appears to create detail rows as well. However, I’ve tried calling the method (as shown below) with no luck as well. It gives me the error “This row already belongs to this table.”
quoteDataset.QuoteDtl.AddQuoteDtlRow((Erp.BO.QuoteDataSet.QuoteDtlRow)quoteDtl_xRow);
I’m basically trying to determine if GetNewQuoteDtl is the best method to use, or if I should consider AddQuoteDtlRow for creating multiple detail lines/rows (and how can I get the dataset to actually add multiple QuoteDtl lines). I haven’t found much info on here in regards to AddQuoteDtlRow.
Thanks for the help!
~ Josh