What does "Ready to Process" mean? Make SURE you understand!

The problem with that, as @timshuwy keeps pointing out, is that the lines are NOT independent. The goofy tax laws could mean a tax rate of x if you sell 1-100, but changes to Y if you sell 100-200. And that’s based on the whole order, not the individual line. So it has to look at the whole order together to properly calculate taxes sometimes. That’s why it can’t just update the one line that changed.

And that is what I call create accounting… :face_vomiting:

Yes. (See that post for the syntax. :point_up: )

I did this testing from the REST help page. Basically the same payload each time.

Test Scenario (new order with 30 lines) Time
1 No Avatax; ReadyToCalc = true (default) 42 sec
2 No Avatax; ReadyToCalc = false THEN another call for ReadyToCalc = true 23 sec + 4 sec = 27 sec
3 With Avatax; ReadyToCalc = true 58 sec
4 With Avatax; ReadyToCalc = false THEN another call for ReadyToCalc = true 20 sec + 4 sec = 24 sec
2 Likes

What the hell went on while I was moving?

T2QP

1 Like

Yup… tax laws are creative… OH… and if you are buying farm equipment in Tennisee, there is no tax, but in Alabama, they have a tax on farm equipment unless you get the F4 exemption which allows you to pay no more tax than your neighboring state (what a wacky law).

yes. use DMT to import everything with Ready to Process = false… then as the last step, turn RtP to True, and it will finish everything up.

2 Likes

Thanks Tim.

Just to be clear, I’m proposing something a little different. I’m taking full control in the Function. I would receive the whole JSON object, validate it (customer exists, parts exists, etc.) then act like a user entering the order but using the BO: add the header, then add each line with releases, and finally do the Ready for Processing. It’s still one call but the Efx is following the trace.

1 Like

Yep, Understood. I just wanted to make clear that a simple API call will not do the trick.

I’ll be telling our eCommerce admins to change their API call to do ReadyToCalc = false to create the order, then set it to true once complete.

…to the Function, right? Not one call to the API.

Like, via API, this will create the order with all lines in one shot and disable Ready to Process…

{
  "Company": "xyz",
  "PONum": "Jason",
  "OrderNum": 0,
  "CustNum": "219",
  "ShipToNum": "",
  "ShipViaCode": "UPS",
  "ReadyToCalc": false, 
  "OrderDtls": [
    {
      "Company": "xyz",
      "OrderNum": 0,
      "OrderLine": 0,
      "PartNum": "10032",
      "UnitPrice": 0.99,
      "OrderQty": 1,
      "ProdCode": "PDCPARTS"
    },
    {
      "Company": "xyz",
      "OrderNum": 0,
      "OrderLine": 0,
      "PartNum": "20288",
      "UnitPrice": 0.99,
      "OrderQty": 1,
      "ProdCode": "PDCPARTS"
    }
  ]
}

But I still need to do this to re-enable Ready to Process (as a second call after the order was made):

{
"Company": "xyz",
"OrderNum": 67620,
"ReadyToCalc":true
}
3 Likes

@JasonMcD it would be great to know the difference with it true vs false with your API call (just to prove the point).

@timshuwy

That’s this post.

1 Like

Yes, but the function IS the API in this case. Still one API call, multiple calls to the BO methods. If that makes sense.

1 Like

Oh, yes, touché. Sorry, we were on the same page and I made that entirely too complicated.

We unchecked Ready to Process to stop AvaTax then DMT’d but some of our DMTs took hours for 20k-ish Releases but worked. Functions weren’t an option back then but @Mark_Wonsil may be onto an idea with a Function.

Bah, excuses! How long have y’all had UBAQs?

I’m doing some testing and I think we can get that down by a few orders of magnitude.

When I get done, we’ll have to talk, and see if I I can make a test function to use your
data, and conditions.

The biggest problem I’ve run into, is apparently functions have a timeout period,
of about 10 minutes. Which is not enough. (I’m currently testing 1000 releases)

It’s consistently taking about 10 minutes per ~500 releases.

I’m thinking a good approach would be to break the releases into batches, and
use the task agent to run them on completion of each batch.

Please guys, your thoughts?

2 Likes

Yes, I imagine that there will be an HTTPS timeout. Functions called from scheduled jobs, etc. would not timeout - I hope.

A pattern discussed on here before was to write the whole order to a UD Table(s) then launch a job to process the order/lines/releases and update a status on the source UD records for error handling, etc.

Bonus points to design like MRP or Scheduling where multiple agents can run at once. :sweat_drops:

Like this: REST API Best Practices — Decouple Long-running Tasks from HTTP Request Processing | by Shawn Shi | Geek Culture | Medium

I’ll pop one up later and find out.

Popped off one from scheduler, ran for 15 minutes and completed.

3 Likes

uBAQs came out in Epicor 9 IIRC much longer than Functions. :stuck_out_tongue: