Adding a QuoteDtl price not getting set

Adding a QuoteDtl price not getting set

In a Quote Update Post-Process, I’m looping through an external quote (json) and adding lines to an existing Quote.

I’m following the trace …
Adding the line/partnum (QuoteDtl) works
Setting the quantity works
Setting price does not work :frowning:

I’ve tried GetDtlUnitPriceInfo and GetDtlUnitPriceInfo_User
The price doesn’t stay set.
These are parts on the fly (not in part master).

Code is below.

Suggestions welcome.
Thanks,
Chris

Erp.Contracts.QuoteSvcContract boQuote = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.QuoteSvcContract>(this.Db);
Erp.Tablesets.QuoteTableset tsQuote = boQuote.GetByID(quoteNum);

JObject jsonObj = JObject.Parse(callContextBpmData.Character02);

foreach (JObject partRow in jsonObj[“QuoteProducts”])
{
boQuote.GetNewQuoteDtl(ref tsQuote, quoteNum);

QuoteDtlRow qdRow = (from dtl in tsQuote.QuoteDtl
                    where dtl.RowMod == "A"
                       && dtl.PartNum == ""
                   select dtl).FirstOrDefault();

string partNum = partRow["ErpProductCode"].ToString();
decimal tempPrice = Convert.ToDecimal(partRow["ProductUnitPrice"]);

qdRow.PartNum = partNum;
qdRow.LineDesc = partRow["Description"].ToString(); 
qdRow.SetUDField<int>("LeadTime_c", (int)partRow["ProductLeadTime"]);


// ChangePartNumMaster start     
bool isPhantom = false;
bool isSalesKit = false;
string uomCode = "";

string vMessageOut = "";
string vPMessageOut = "";
string vBMessageOut = "";
bool vSubAvailOut = false;
string vMsgTypeOut = "";

string cDeleteComponentsMessageOut = "";
bool multipleMatchOut = false;
bool promptToExplodeBOMOut = false;
string explodeBOMerrMessageOut = "";

boQuote.ChangePartNumMaster(partNum: ref partNum,
  lIsPhantom: ref isPhantom,
  lIsSalesKit: ref isSalesKit,
  uomCode: ref uomCode,
  rowType: "",
  SysRowID: Guid.Empty,
  salesKitView: false,
  removeKitComponents: false,
  suppressUserPrompts: false,
  runChkPrePartInfo: true,
  vMessage: out vMessageOut,
  vPMessage: out vPMessageOut,
  vBMessage: out vBMessageOut,
  vSubAvail: out vSubAvailOut,
  vMsgType: out vMsgTypeOut,
  getPartXRefInfo: true,
  checkChangeKitParent: true,
  cDeleteComponentsMessage: out cDeleteComponentsMessageOut,
  multipleMatch: out multipleMatchOut,
  promptToExplodeBOM: out promptToExplodeBOMOut,
  explodeBOMerrMessage: out explodeBOMerrMessageOut,
  ds: ref tsQuote);


// ChangePartNum
boQuote.ChangePartNum(ds: ref tsQuote,
    lSubstitutePartsExist: false,
    uomCode: uomCode);

boQuote.Update(ref tsQuote);

// ChangeSellingExpQty
qdRow.RowMod = "U";
qdRow.OrderQty = Decimal.Parse(partRow["ProductQuantity"].ToString());
qdRow.SellingExpectedQty = Decimal.Parse(partRow["ProductQuantity"].ToString());
boQuote.ChangeSellingExpQty(ds: ref tsQuote);

boQuote.Update(ref tsQuote);

// GetDtlUnitPriceInfo 
qdRow.RowMod = "U";
qdRow.DocDspExpUnitPrice = tempPrice;
boQuote.GetDtlUnitPriceInfo(skipDiscLookup: false,
    preserveAmt: false,
    ds: ref tsQuote);

boQuote.Update(ref tsQuote);

}

this.dsHolder.Attach(tsQuote);

@DmcChris Have you tried just setting all of the unit prices and the LockPrice and OverridePriceList flags?

Greg,
Thank you for taking the time to look at my issue!

I went back through the trace and tried the _User version of the method and it worked.
I must have missed setting the parameters correctly for that call or something.

It works now. Below is the updated call.

// GetDtlUnitPriceInfo_User qdRow.RowMod = "U"; qdRow.DocDspExpUnitPrice = tempPrice; boQuote.GetDtlUnitPriceInfo_User(skipDiscLookup: true, preserveAmt: true, pIsGridPasting: false, pChangedByUser: true, ds: ref tsQuote);
boQuote.Update(ref tsQuote);
1 Like