Hello folks, I’m working on a script that does the following in Opportunity/Quote Entry:
1.Save the current QuoteQty.DocUnitPrice value when the QuoteQty.SellingQuantity value is changed.
2.Set the QuoteDtl.OrderQty and QuoteDtl.SellingExpectedQty fields to match QuoteQty.SellingQuantity when it is changed.
3.Show a MessageBox that lists the values of each quantity field.
I’ve written some code that seems like it SHOULD work, but it’s giving me the following error:
From the digging I’ve done so far, it seems like the solution to this involves the GetByID() method on the QuoteQty table. Unfortunately, I don’t know how to call that method in the Script Editor window. I’m looking through the Programmer’s Guide and it mentions calling methods, but lists syntax that only seems to work in the BPM “Execute custom code” box. I’m not sure why the syntax doesn’t work here.
And of course, here is my code so far:
private void QuoteQty_AfterFieldChange(object sender, DataColumnChangeEventArgs args)
{
switch (args.Column.ColumnName)
{
case “SellingQuantity”:
EpiDataView edvQuoteQty = (EpiDataView)(this.oTrans.EpiDataViews["QuoteQty"]);
EpiDataView edvQuoteDtl = (EpiDataView)(this.oTrans.EpiDataViews["QuoteDtl"]);
edvQuoteDtl.CurrentDataRow["OrderQty"] = (decimal)edvQuoteQty.CurrentDataRow["SellingQuantity"];
edvQuoteDtl.CurrentDataRow["SellingExpectedQty"] = (decimal)edvQuoteQty.CurrentDataRow["SellingQuantity"];
MessageBox.Show("Quote qty " + (decimal)edvQuoteQty.CurrentDataRow["SellingQuantity"] + Environment.NewLine +
"Order qty " + (decimal)edvQuoteDtl.CurrentDataRow["OrderQty"] + Environment.NewLine +
"Exp. qty " + (decimal)edvQuoteDtl.CurrentDataRow["SellingExpectedQty"]);
edvQuoteQty.CurrentDataRow["DocUnitPrice"] = MyDocUnitPrice;
edvQuoteDtl.CurrentDataRow["DocExpUnitPrice"] = (decimal)edvQuoteQty.CurrentDataRow["DocUnitPrice"];
break;
}