Quote Line Item Tax Category Assignment via BPM

I have written a BPM that basically transforms an external quote dataset into an Epicor quote. I am suddenly running into an issue that the tax category on the lines (QuoteDtl.TaxCatID) is not getting populated by the value I want entered from our external quote system.

BPM CODE Example
//start with three variables
DataSet myQDS;  //dataset contains all data necessary for creating epicor tables
int myEpicorQuoteNumber; //the generated quotenumber..
QuoteTableSet myQuoteTS; //the Epicor tableset

using (var qsvc=Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.QuoteSvcContract>(this.Db))
{ 
      //create each line
      foreach(DataRow myline in myQDS.Tables["QuoteLine"].AsEnumerable())
      {
        decimal mprice =  Convert.ToDecimal((double)myline["UnitPrice"]);
        qsvc.GetNewQuoteDtl(ref myQuoteTS,myEpicQuoteNumber); //get new line
        var qdline = (QuoteDtlRow)myQuoteTS.QuoteDtl.Last(); //pointer to new line
        qdline.PartNum = (string)myline["PartNumber"];
        qsvc.ChangePartNum(ref myQuoteTS,false,"");
        qdline.LineDesc = (string)myline["Description"];
        qdline.SalesCatID = (string)myline["SalesCategory"];
        qdline.ProdCode = (string)myline["ProdCode"];
        qdline.SellingExpectedQty = (int)myline["Qty"];
        qdline.SellingExpectedUM = "EA";
        qdline.OrderQty = (int)myline["Qty"];
        qdline.OrderUM = "EA";

//need to call an update here because the pricing and tax category expect the data already exists in the database, not just in memory
        qsvc.Update(ref myQuoteTS); 
    
//Service expects the before image to get passed as well so we have to duplicate the line and modify the pricing information.  For some reason tax category doesn't work
        var ndr = new QuoteDtlRow();
        BufferCopy.Copy(qdline,ref ndr);
        myQuoteTS.QuoteDtl.Add(ndr);
        ndr.RowMod = "U";
        ndr.DocDspExpUnitPrice = mprice;
        qsvc.GetDtlUnitPriceInfo_User(true,true,false,true,ref myQuoteTS);
        ndr.OverridePriceList = true;
        ndr.TaxCatID = "LABCONMOD"; //this never gets populated, always blank
        ndr.TaxCatIDDescription= "LABOR CONSTRUCTION"; //this never gets populated, always blank
        qsvc.Update(ref myQuoteTS);

A trace on the client for the modification of the field indicates something gets changed on the TaxConnectStatus table as well. However, that is not new and I’ve have tried modifying this via code prior to the second update in the BPM but to no avail…

    <paramDataSet name="ds" useDataSetNbr="0">
      <changedValue tableName="QuoteDtl" rowState="Modified" rowNum="0" colName="TaxCatID"><![CDATA[LABCONMOD]]></changedValue>
      <changedValue tableName="QuoteDtl" rowState="Modified" rowNum="0" colName="TaxCatIDDescription"><![CDATA[LABOR CONSTRUCTION]]></changedValue>
      <changedValue tableName="TaxConnectStatus" rowState="Modified" rowNum="0" colName="ETCOffline"><![CDATA[True]]></changedValue>
      <changedValue tableName="TaxConnectStatus" rowState="Modified" rowNum="0" colName="RowMod"><![CDATA[U]]></changedValue>
    </paramDataSet>

Also, if it is relevant, we do not use Avalara. Anyway, I’m pretty sure this was working when I created it a few months ago and we noticed some tax related issues on Quote Entry between the two versions (per KB0102392 - Taxes for Tax Inclusive Liabilities cannot have exemptions so I’m thinking maybe something changed between 10.2.300.20 and 10.2.300.37 but I’m struggling to find what is breaking it. Does anyone have any suggestions?

Thanks,
Tanner

So after much frustration, I eventually figured this out. Apparently, after adding engineering data and updating the quote detail information a second time, TaxCatID was getting wiped out. I followed the code pattern list with BufferCopy and was able to resolve. Sometimes it’s hard when the answer is right in front of your face! :tired_face:

1 Like