Business requirement: show overwrite prices and discounts dialog for new SalesLine field
If you add a new field to the SalesLine or SalesQuotationLine table, and this field is important for trade agreement evaluations, you should add some code for this field, to enable the Trade Agreement Evaluation functionality. Else, the dialog asking to Overwrite Prices And Discounts won’t appear upon changing this new field.
Solution
Add the new field to the Map PriceDiscResultFields and configure the necessary Mappings with the SalesLine and or SalesQuotationLine table.
In method isTriggerFieldChanged from Map PriceDiscResultFields, add following code for your new field:
…
boolean lineFieldChanged()
{
return _priceDiscResultFields.SalesPurchQty
!= priceDiscResultFieldsOrig.SalesPurchQty
|| _priceDiscResultFields.SalesPurchUnit
!= priceDiscResultFieldsOrig.SalesPurchUnit
|| _priceDiscResultFields.CurrencyCode
!= priceDiscResultFieldsOrig.CurrencyCode
|| _priceDiscResultFields.RecieptDeliveryDate
!= priceDiscResultFieldsOrig.RecieptDeliveryDate
|| _priceDiscResultFields.Price
!= priceDiscResultFieldsOrig.Price
// BEGIN
|| _priceDiscResultFields.YourNewField
!= priceDiscResultFieldsOrig.YourNewField;
// END
}
In Class SalesLineType, method validateField, add following code:
// BEGIN
case fieldNum(SalesLine, YourNewField):
ok = salesLine.runPriceDiscPolicyDialog();
break;
// END
Continue reading......