BPM to not allow an invoice date to be in the future

Hello, I was wondering if anyone had any general ideas on how to create a BPM to not allow an invoice date to be past the current day.


First step would be to decide whether you wanted it as a data directive (any entry going into the table) or method directive (anything going through that specific process). For your example, I would probably use a data directive. So find the table and the field you want to compare, and create an in-transaction data directive. Then make a condition that compares the invoice date in the TTTable to todays dates and if greater than, raise an exception.

From your question, you sound like you are pretty new to BPMs. I would start with the tools guide in the help system to get you acclimated to what’s available to use. Your specific example should be pretty easy to accomplish.

Once you read through the BPM stuff, give it a shot and let us know where you get stuck.

One “trick” might be to force the Invoice Date and the SHIP date to be equal… then disallow packslips that are in the future.
There is already a setting in the Company configuration regarding Invoice/Ship date.
To disallow packslips with future dates is fairly easy… create a Method BPM on the customer shipment Update process (pre processing) that validates the date is today or before… if not, throw an exception message. THEN when Accounting does the "Get shipments, the invoice dates are guaranteed to be today or before.

1 Like

I would question whether you want an invoice date to NOT be in the future, or an invoice to NOT be posted that is NOT in the future. I could see where you may create a batch at the end of the day with invoices in the next day, with an intent on posting the next day.

I would be inclined to put the BPM on the posting process. There’s a method that gets called when you click Actions -> Group -> Post, you can do a trace but it’s something like “PrePostInvoice”. Then, use advanced code to read through the invoices in the group, and if any have a future date, throw an exception to the screen. You could even add the offending invoices to the error message if you wanted to be really user friendly!!!

Kevin Simon

Old post I know… but…

In vantage 8, would this go on the InvGroup.PostInvoices or on APInvGrp.Update or ApInvoice.Update?

I think ApInvoice.Update would be the right place and use condition “the ApInvHed.InvoiceDate field of the change row is more than the specific value” but I don’t know how to put a variable in there that pulls today’s date into the condition. Or do I need to do an advanced condition to do that?

The way I’ve done this is on the PrePostInvoices method. I’m not sure if Vantage 8 has that, I’m pretty sure it was there then though. The thought is:

  1. You’re not interrupting the posting process by putting it in the PostInvoices process. Just a little safer, in my opinion.
  2. You’re allowing the users to enter post-dated invoices, they just can’t post them. Again, they might enter one today with a date of tomorrow and intents to post tomorrow - why stop them.

It does have it, but I assume I need to write code for an advanced condition to execute it?

Yeah, you’re probably right in Vantage 8. Later versions you could have a condition where it’s using a query widget.

If you were to write code, I probably wouldn’t do an advanced condition, but rather just custom code that throws an exception. Something like:

define variable errMessage as Character initial "back to the present dude".
for first APInvHed no-lock 
    where APInvHed.Company = CUR-COMP
      and APInvHed.GroupID = pGroupID (should be a parameter)
      and APInvHed.Posted = false
      and APInvHed.InvoiceDate > TODAY
    {lib/PublishEx.i &ExMsg = "'errMessage'" &ExType = {&MESSAGE_ERR}}

Syntax might not be right, but should be close.

Thank you, I will check it out and see what needs to be tweaked