Product Configurator and Discount Price Lists

Hi all,

We’ve got an issue that has been floating around for some time and has reared its head again recently. I posted about it previously here and but apparently the problem still exists in our system.

In a nutshell, we have a Configurator that runs from a dummy part number. Input from this configurator creates the actual part number which is then updated via a smart string in Configurator Entry record creation.

For certain customers, this part receives an additional price % discount on top of their customer % discount. We handle this through Discount Price Lists.

What we’re finding is that because the part number is amended through the Configurator the Discount Price List isn’t being applied. The system identifies that the discount list exists - it’s being listed and automatically selected in the Disc Price List dropdown, but the discount doesn’t get added until we change one of a number of fields manually.

Pre Configurator being run (this particular customer had a base discount of 18%, set in Customer Maint):
image

Post Configurator being run (config has updated the part number, qty, unit cost among other things):
image

As can be seen here, the Discount Price List has been found but the discount not applied. If I check Override Disc Price List then uncheck it we get the expected result:
image

I’ve tried umpteen different BPMs to rectify this but can’t seem to get the correct discount to apply when the Configurator saves.

Any suggestions? Thanks in advance!

Hi Ryan,

I have a similar setup with discounts being applied to various customers via the configurator and ran into a few issues trying to update the discount. You could go a few routes here, depending on what you think is best maintenance-wise for your situation.

First, you could create a BPM to call when the configuration DocRules update. I’d have to play with this a little to make sure I get the update rules correct, but if this is the route you want to go, I could show you how to do it.

A little bit easier (and cleaner IMO, since you’d still be controlling via configurator), you could create a method that looks up the discount % from PLPartBrk.DiscountPercent, then adds that to the existing OrderDtl.DiscountPercent.

The method would look like this:

decimal AddDiscRate = 0;

Erp.Tables.OrderDtl OrderDtl = (from Row in Db.OrderDtl where Row.Company == Context.CompanyID && Row.OrderNum == Context.OrderNumber && Row.OrderLine == Context.OrderLineNumber select Row).FirstOrDefault();

if (OrderDtl != null) {
	
	Erp.Tables.PLPartBrk PLPartBrk = (from Row in Db.PLPartBrk where Row.Company == Context.CompanyID && Row.ListCode == OrderDtl.DiscBreakListCode select Row).FirstOrDefault();

	if (PLPartBrk != null) AddDiscRate = PLPartBrk.DiscountPercent;
}

return AddDiscRate;

And then you could add the following to your OrderDtl Document Rules:

decimal oldRate = OrderDtl.DiscountPercent;
decimal newRate = oldRate + UDMethods.getAddDiscRate();

OrderDtl.DiscountPercent = newRate;

This should grab the existing discount (in your screenshots, the 18%), and add the discount rate from the Discount Price List on the Sales Order > Lines > Detail tab, as well as refreshing the price automatically.

1 Like

Hi Kevin,

Thanks for taking the time for this detailed response.

One of our biggest problems was that the order was created with a dummy part number - the part associated with the discount code wasn’t being applied until the configurator had completed. I’m guessing that the methods associated with discount price lists fire before the configurator renumbers the part, hence they were being missed by the usual processes as the lookup for this discount was using our dummy part number, which isn’t listed in the discount price list.

I had a BPM hooked up to SalesOrder.MasterUpdate, which checked that discount codes weren’t being overridden and applied the prices before save, but this relied on our sales order entry to complete that final save before proformas were created. While this worked for the most part, human error was still an element but we caught the vast majority of unapplied discounts this way.

I’d also thought of attaching the BPM to the ConfiguratorRuntime.ProcessDocRules method but unfortunately BPM could only be attached to something like ProcessDocRulesExt (my memory’s a little hazy on the exact method) but my trace log showed that ProcessDocRules was being called and so the BPM wasn’t called.

Your code got me thinking further though and I was able to tweak it a little to pull in the correct discount codes. I already had the new part number captured in a textbox so I just needed to feed this into the PLPartBrk lookup as well and be sure to capture any cases where we might have multiple discounts applied. The code ended up looking like this:

decimal dDiscRate = 0;
string sPN = Inputs.txtPartNum.Value;

var PriceList = (from Row in Db.CustomerDiscPriceLst 
where Row.Company == Context.CompanyID && Row.CustNum == Context.CustomerNumber select Row).ToList();

// if no price list is found, exit
if (PriceList == null){return dDiscRate;}

foreach (var pl in PriceList)
{
	Erp.Tables.PLPartBrk PLPartBrk = (from Row in Db.PLPartBrk where Row.Company == Context.CompanyID && Row.ListCode == pl.ListCode && Row.PartNum == sPN select Row).FirstOrDefault();
	if (PLPartBrk != null) dDiscRate += PLPartBrk.DiscountPercent;
}

return dDiscRate;

Many thanks for your input on this - I’m happy to put this problem behind us now and deliver this as a much better solution to what we were previously doing.

Regards,

Ryan

1 Like

Glad you were able to solve it! Can’t believe I didn’t think of the foreach statement in case there were other discounts attached.