Updatable BAQ for QuoteMsc not updating Amount

Hi All,

I am trying to create an updatable BAQ to add/update line misc charges for Quotes.
I would like the ability to change Freq, Charge ID, Description and Amount.
I am able to add line and update all BUT the Amount field.
Every time I try, it updates back to the default price.
I also tries both MiscAmt and DocMiscAmt from the QuoteMsc table.

I understand that the correct businessobject/method to do this with is :
Erp.Proxy.BO.QuoteImpl
ChangeMiscAmt

But I can only access BO Quote, method Update through the BAQ.

Any ideas how to make this work? Any help is much appreciated.


Before Update:

After Update:

Is the Misc Code being used normally setup for “Amount” or “Pct”. If It’s Pct, you might need to do it in two steps, first change the Type from “P” to “A”, then set the Amount

All Misc charges are currently set up as Amount.

This is an old post, but it is still the top result for this specific method call, which can be a bit tricky. Here’s how to properly use the method in question:

  1. Retrieve the BO dataset
  2. Retrieve the QuoteMsc (or QuoteHedMsc when QuoteLine = 0) row to be modified
  3. BufferCopy.Copy(originalRow, newRow) and add the newRow to the corresponding table in the BO dataset with RowMod = “U”.
  4. Manually set the newRow.DocDspMiscAmt field, which is the field being set in the front end.
  5. Call the ChangeMiscAmt method and then the update method.

Here is some sample function code. As a disclaimer, I just typed this freehand and didn’t test this sample, but it should work:

decimal docMiscAmtValue = /*TODO your value here*/ 40M;
Guid mySysRowID = /*TODO your value here*/ Guid.NewGuid();
int myQuoteNum = /*TODO your value here*/ 12345;
string tableName;
this.CallService<Erp.Contracts.QuoteSvcContract>(hQuote => {
            Erp.Tablesets.QuoteTableset qeds = new Erp.Tablesets.QuoteTableset();
            qeds = hQuote.GetByID(myQuoteNum);
            // Misc is on a line. For example, QuoteLine != 0
            var quoteMscOrig = qeds.QuoteMsc.Where(x => x.SysRowID == mySysRowID).FirstOrDefault();
            if(quoteMscOrig != null)
            {
               tableName = "QuoteMsc";
               Erp.Tablesets.QuoteMscRow quoteMsc;
               BufferCopy.Copy(quoteMscOrig, quoteMsc);
               qeds.QuoteMsc.Add(quoteMsc);
               quoteMsc.RowMod = IceRow.ROWSTATE_UPDATED;
               quoteMsc.DocDspMiscAmt = docMiscAmtValue;
               hQuote.ChangeMiscAmt(ref qeds, tableName);
               quoteMsc.RowMod = IceRow.ROWSTATE_UPDATED;
               hQuote.Update(ref qeds);
            }
            // Misc is on the header. For example, QuoteLine == 0
            else
            {
                var quoteMscOrig = qeds.QuoteHedMsc.Where(x => x.SysRowID == mySysRowID).FirstOrDefault();
                if(quoteMscOrig != null)
                {
                     tableName = "QuoteHedMsc";
                     Erp.Tablesets.QuoteHedMscRow quoteMsc;
                     BufferCopy.Copy(quoteMscOrig, quoteMsc);
                     qeds.QuoteHedMsc.Add(quoteMsc);
                     quoteMsc.RowMod = IceRow.ROWSTATE_UPDATED;
                     quoteMsc.DocDspMiscAmt = docMiscAmtValue;
                     hQuote.ChangeMiscAmt(ref qeds, tableName);
                     quoteMsc.RowMod = IceRow.ROWSTATE_UPDATED;
                     hQuote.Update(ref qeds);
                }
            }
});
1 Like