# GetNewQuoteDtl vs AddQuoteDtlRow

**URL:** <https://www.epiusers.help/t/getnewquotedtl-vs-addquotedtlrow/59188>\
**Category:** Epicor ERP 10\
**Tags:** custom-code, e10, epicor\
**Created:** [August 28, 2019, 1:02pm UTC](https://www.epiusers.help/t/getnewquotedtl-vs-addquotedtlrow/59188 "2019-08-28T13:02:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbrekke](https://www.epiusers.help/letter_avatar_proxy/v4/letter/j/eb9ed0/32.png) [@jbrekke](https://www.epiusers.help/u/jbrekke)\
**Post date:** [August 28, 2019, 1:02pm UTC](https://www.epiusers.help/t/getnewquotedtl-vs-addquotedtlrow/59188/1 "2019-08-28T13:02:35Z")

</div>

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:

```auto
                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).

![image](https://epiusers.help/uploads/default/original/3X/0/8/089f62558adb2fd7f4bd646e1fe48256edc3d12d.png)

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.”

```auto
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

---

<div class="post-metadata">

**Author:** ![Jason\_Woods](https://www.epiusers.help/user_avatar/www.epiusers.help/jason_woods/32/80101_2.png) [@Jason\_Woods](https://www.epiusers.help/u/Jason_Woods)\
**Post date:** [August 28, 2019, 2:44pm UTC](https://www.epiusers.help/t/getnewquotedtl-vs-addquotedtlrow/59188/2 "2019-08-28T14:44:08Z")

</div>

You likely want GetNewQuoteDtl. You will see in a trace that this is likely what the system does.  
Try putting the Update inside the loop.  
Also, you may want to select the row with RowMod=A instead of LastOrDefault.

---

<div class="post-metadata">

**Author:** ![jbrekke](https://www.epiusers.help/letter_avatar_proxy/v4/letter/j/eb9ed0/32.png) [@jbrekke](https://www.epiusers.help/u/jbrekke)\
**Post date:** [August 28, 2019, 4:38pm UTC](https://www.epiusers.help/t/getnewquotedtl-vs-addquotedtlrow/59188/3 "2019-08-28T16:38:49Z")

</div>

Thanks for your input Jason. I’ve set the RowMod to “A”, but still just creates the one line.

Since the **GetNewQuoteDtl** method is a void, how else would I get the row that was created?

---

<div class="post-metadata">

**Author:** ![Jason\_Woods](https://www.epiusers.help/user_avatar/www.epiusers.help/jason_woods/32/80101_2.png) [@Jason\_Woods](https://www.epiusers.help/u/Jason_Woods)\
**Post date:** [August 28, 2019, 4:46pm UTC](https://www.epiusers.help/t/getnewquotedtl-vs-addquotedtlrow/59188/4 "2019-08-28T16:46:51Z")

</div>

You will want to SELECT the row where RodMod=A

---

<div class="post-metadata">

**Author:** ![jbrekke](https://www.epiusers.help/letter_avatar_proxy/v4/letter/j/eb9ed0/32.png) [@jbrekke](https://www.epiusers.help/u/jbrekke)\
**Post date:** [August 28, 2019, 4:55pm UTC](https://www.epiusers.help/t/getnewquotedtl-vs-addquotedtlrow/59188/5 "2019-08-28T16:55:37Z")

</div>

That gets the row just as the LastOrDefault does. However, I’m trying to create new entries in the dataset which don’t appear to happen each time I call **GetNewQuoteDtl**. I would have thought it would, but it will only add one record no matter how many times I call the method.

I currently have code that does call the update inside a loop. However, I’m trying to create a “batch” add process that would add multiple detail records and then save them.
