Autoprint BPM fires but report is not generated after WCF call to CustShip.InvoiceShipment

Hello All -

Pulling my hair out on this one - hope you can help! I have an AutoPrint that works perfectly when I execute my process flow via the Epicor Client, but fires without generating output when I execute the same process flow against the WCF BOs.

Broad strokes, the purpose is to automate our AR Invoicing process and steps go like this:

  • Sales Order is entered with the ERSOrder (AutoInvoice) flag set to True
  • The warehouse physically ships the orders then sends us a CSV file with shipment details.
  • We import the CSV to create a new packslip (Add records to CustShipTableSet.ShipHead and CustShipTableSet.ShipDtl, set ReadyToInvoice = true and call CustShip.UpdateExt)
  • Then I call CustShip.InvoiceShipment to generate the AR Invoice.
  • Finally, I have an AutoPrint Data Directive BPM that fires when InvcHead is changed. This is used to either a.) email an SSRS Invoice to a customer using Advanced Print Routing or b.) generate EDI invoice output to a text file:

image

Everything runs as expected (packing list is marked shipped, invoice is posted, etc.) and the AutoPrint BPM is definitely firing and reaching the end of its workflow (as you can see, I attach some “debug” Data Tags to the InvcHead record during BPM execution), but no output - either when exporting SSRS to APR or using EDI output.

The frustrating part is that if I skip setting ReadyToInvoice = true and CustShip.InvoiceShipment in my code and manually tick the ‘Shipped’ checkbox in Customer Shipment Entry, I do get APR and/or EDI output (despite the trace matching exactly what I’m doing.)

Can anyone think of a way to get this to work? I suspect it may have something to do with my WCF session being transient, but if that’s the case I can’t understand why my “printed” data tag would have attached without issue.

Sorry for the longwinded post!

Thanks!
Ken

Kent, I had found auto printing the credit card invoice to be equally as challenging, maybe you are running into the same issues.

take a look at this post…you may need to create two data directives to get the auto print working.

Thanks Bryan - yes, I ran into that specific issue earlier in my development. I do in fact now have an InTran data directive that enables the directive shown above. The “Should Print?” condition says “If this directive was enabled by…”.

Unfortunately, that’s not my issue :frowning:

Okay, getting closer on this!

The report is failing during SubmitToAgent due to an expected string value that is null.

After debugging the BPM and trial and error on each null field in the ArInvFormParam tableset, I determined that WorkstationID is null when the BPM is triggered from WCF.

Unfortunately, WorkstationID cannot be set from the UI:
image

Any ideas how I can get that value set? I tried using a custom code block, but ArInvFormParam isn’t in scope yet and setting a value for Session.WorkstationID doesn’t seem to carry through to the params.

Hi @Rich you mentioned a similar issue in this post:

But, it doesn’t look like it was ever resolved. I am running my auto-print BPM “Queued”, but WorkstationID is still null and the printing fails.

Can you advise on how I can set ArInvFormParam.WorkstationID since it’s required, but not available in the UI?

Thanks!

If you have access to your session, you can get it from there. I believe it’s just Session.workstationID

Success! I needed to set Session.TaskClientID rather than Session.WorkstationID. Apparently Session.TaskClientID is mapped to ArInvFormParam.WorkstationID.

Auto-invoice with an Auto-print BPM is now working from WCF.

Thanks everyone!

1 Like