Determine what Line number was just created in Post Processing BPM

I have a post processing BPM that I am running on creation of a sales order Line. It has a condition to fire off of a pre-processing directive.

I need to know what order line was created, and when I set it in the pre-processing directive, it is still 0.

Would something like this work?

var vDbOrderdtl = (from x in erpContext.Db.OrderDtl where  x.Company == "Company" && x.OrderNum== callContextBpmData.Number04   && x.OpenLine==true select x).LastOrDefault();


What is the pre process directive?

You code looks like it’s trying to query the DB… not sure that is what you are trying to do or not.

It has been my experience when you’re using the Post-Processing directives, that only the record that was updated is available in the tt table. Example, you have two lines on a SO and are adding a third line. If you query your ttOrderDtl table in the pre-processing, you’d see:

  • Line 1 with rowmod blank
  • Line 2 with rowmod blank
  • Line 0 with rowmod “A”. This is what it’s adding.

After Epicor does it’s update, here’s what’s available in the post-processing directive:

  • Line 3: rowmod blank (because it’s already been added.

So, on the post method, it should just be the only tt record that’s out there for OrderLine.

As an FYI, updates work a little similar. On the PRE: you’d still have lines 1 and 2 with a blank rowmod. However, you’d see two Line 3’s there: a rowmod blank (the before image) and a rowmod “U” (the updated record. Again, on the post, you’d see just the updated line 3 and rowmod would be blank as that has been committed to the DB.

My safe harbor: please test this. For every rule in how things work in Epicor, you’ll find exceptions. I’m quite sure Order Entry follows this process, but I seem to remember things like inventory transfer does not. It’s been this way since the early days of BPM’s (super-procedures), so it should be pretty safe.

1 Like

Looks like the ds.OrderDtl table contains all lines in the post processing directive.

Below code returns the correct record that was just created

var vorddtl = (from x in  ds.OrderDtl where x.Company == callContextClient.CurrentCompany && x.OrderNum== callContextBpmData.Number04   select x).LastOrDefault();