Automating Invoice Miscellaneous Charges

Hello all. I have recently been given a requirement to automatically add a miscellaneous charge to each line of our AR invoices. It has to be at the line level because the charges are based on certain criteria (part, quantity, customer, etc.). It has to be at invoice instead of sales order because of the way our product is created the customer may be shipped a slightly different amount than what they ordered (ie. customer orders 1000lbs and gets shipped 1004lbs). The charge needs to be based on the quantity that was actually shipped. I was able to automate the charge for a single invoice pretty easily through a basic customization but I’m stuck on trying to add the charge to every line on every invoice in a group. I’m not sure if I should scrap the customization and start looking at a BPM. Any suggestions?

The BPM route will be better for automation, as it requires no user intervention. It could run when each new line is created. Logic in the BPM could determine if the Misc charges are necessary, and if so, prepopulate misc charges’ details.

One thing you’ll have to determine, is if the misc charges info can be determined when the invoice line is first created, or if it should run when the line is saved. The later allows for the misc charges to be calculated after manual changes to the line are made.

Thanks for the response Calvin. I decided the BPM route would be the better choice as well. Unfortunately, now I’m kind of stuck in the same situation. I’m using the Invoke BO Method widgets to add the charge just fine, but I’m having to use it at Update which is causing the charge to only be added to the line I’m currently on. I wanted to use this on GetNewInvcDtl so it would fire as each line is created but, according to my trace log, pulling in shipments to create the invoices never uses that method. Do you know of any way to make the BPM iterate through each individual line item at Update or do you think this is going to require some custom code?

Yeah, it seems like ARInvoice.GetShipments() does a lot of heavy lifting.

You’ll probably need to resort to using code to be able to loop through all the lines created via that single invocation of the BO method.

Looping through records really isn’t my specialty. But some things to consider, would be:

  • Make a Misc Charge code (call it MC-BPM) just for these BPM’s. Set it as Amount type with a default of $0.00, and a frequency of time every.
    *. Check to see if there already a Misc Charge MC-BPM before adding it. This way if for some reason the BPM gets fired again, you won’t double up the charges
  • For debugging, dynamically set the description to include info from the BPM