Update Quote UOM from Configurator Document Rules

I have a simple product configurator where, among other options, the user enters how many pieces they want of the part. Depending on this and some logic, I need to update the quote selling qty and the UOM on the quote line. I can accomplish this with the following code in the Document rules:

QuoteDtl.SellingExpectedQty = qty;
QuoteDtl.OrderQty = qty;
QuoteDtl.SellingExpectedUM = uom;

I assumed this would just work and it mostly does, except when it changes the UOM, the unit price of the “EA” UOM is pulled in regardless of what the UOM was changed to. And it seems like the “EA” unit price is then treated like the unit price for the UOM that was switched to, because when I switch the UOM back manually to “EA”, then the price divides to something smaller.

Even more strange, when I delete the line to start over, and manually add a line with the same part number again, then nothing updates anymore when I change the UOM or the quantity. I can even open a brand new quote with that part number and nothing updates there either. Only until I clear my browser cache, does everything work again.

I also tried doing a trace in the browser of what happens when I change the UOM in the quote manually, and I tried doing all of that in a Function:

Erp.Tablesets.QuoteTableset quoteTableset = new Erp.Tablesets.QuoteTableset();
Erp.Tablesets.QuoteDtlRow quoteDtl = new Erp.Tablesets.QuoteDtlRow();
Erp.Tablesets.QuoteDtlRow quoteDtlUpdate = new Erp.Tablesets.QuoteDtlRow();

this.CallService<Erp.Contracts.QuoteSvcContract>(quoteSvc => { 
  var quote = quoteSvc.GetByID(quoteNum);
  var quoteDtlToCopy = quote.QuoteDtl.Where(qd => qd.QuoteLine == quoteLineNum).FirstOrDefault();
 
  BufferCopy.Copy(quoteDtlToCopy, quoteDtl);
  BufferCopy.Copy(quoteDtlToCopy, quoteDtlUpdate);
  
  quoteDtlUpdate.SellingExpectedUM = newUOM;
  quoteDtlUpdate.RowMod = "U";
  
  quoteTableset.QuoteDtl.Add(quoteDtl);
  quoteTableset.QuoteDtl.Add(quoteDtlUpdate);
  
  quoteSvc.GetDtlUnitPriceInfo(false, false, ref quoteTableset);
  quoteSvc.ChangeSellingExpQty(ref quoteTableset);
  quoteSvc.Update(ref quoteTableset);
});

This works when called through rest, but does not work when called from the Document Rules.

What can I do to change the UOM in the quote from the Configurator?

What else are you doing with your rules and record creation rules. For example, if you are setting the part number, to something that exists in epicor, after setting the uom I believe it will then set the uom to the new part default eliminating what you did with you document rule.

To be clear, I tried the Function approach only after trying to simply setting QuoteDtl.SellingExpectedUM in the document rules.

If I do it the simple way, and just set the part number to an existing part in Document rules, then set the UOM in QuoteDtl.SellingExpectedUM, it pulls in the price and discount for the EA UOM, instead of the UOM it was set to.

In 10 I thought there is a QuoteDtl.SetDefaults or something like that that will update all the part defaults. I would assume it’s still in Kinetic but maybe not?

It might be SetPartDefaults, I can’t remember the exact naming convention.