Issues with REST, marking Pack Slip Ready to Invoice

I’ve created a couple other posts and now finding this one that I believe is related.

In short, we’re trying to use @josecgomez REST library to make API calls to close a sales orders by marking a customer shipment as shipped.

We’ve got all the way to the point where we’re trying to mark it ReadyToInvoice and all kinds of crazy things are happening – it’s inconsistent.

I don’t want to hijack this thread but are there any other threads that outline a working solution for this problem? Maybe input from @Bart_Elia?

REF: Logic works in BL Tester, but not BPM Code (Mass Shipment)
REF: WCF to Set Order Shipment as Ready to Invoice

Just by curiosity, have you tried to put your logic in an Epicor Function AND calling it from REST AND make sure your logic contains a Before Image (@josecgomez code below )?

Hi Louis, good morning.

No. I’m not familiar with Epicor enough to make calls outside the scope of REST endpoints. Plus, we just upgraded from Vantage 8 to E10 Cloud.

And while I am a seasoned C# developer, it’s not a technical matter, it’s a matter of digesting and understanding the internal Epicor objects and framework to get it done w/ best practices.

We know that Functions are on the rise, but I’ve got too many sticks in the fire right now to take that learning curve on.

I’m hoping that someone has a solution that I can use direct via REST.

We’ve got all the Customer Shipment steps in play (GetNewShipHead thru to MarkShipmentLines and then MasterUpdate), all working as expected. It’s just the last final next steps that’s needed to mark them ReadyToInvoice that’s creating the problem.

Hi Jeff
What specifically are you seeing? My guess it’s the Before Image issue but if you give us some more specific feedback about what you are seeing we may be able to help.

Hey Jose, I’m going to run a new end-to-end fresh test right now so that I have the full clean dataset info handy, should you ask for additional details.

1 Like

Ok, I run through all the steps to create the Customer Shipment …

EpicorRest.DynamicPost("Erp.BO.CustShipSvc", "GetNewShipHead", postData);
EpicorRest.DynamicPost("Erp.BO.CustShipSvc", "GetHeadOrderInfo", postData);
EpicorRest.DynamicPost("Erp.BO.CustShipSvc", "GetLegalNumGenOpts", postData);
EpicorRest.DynamicPost("Erp.BO.CustShipSvc", "UpdateMaster", postData);
EpicorRest.DynamicPost("Erp.BO.CustShipSvc", "PreCreateMassShipDtl", postData);
EpicorRest.DynamicPost("Erp.BO.CustShipSvc", "CreateMassShipDtl", postData);
EpicorRest.DynamicPost("Erp.BO.CustShipSvc", "GetManifestInfo", postData);
EpicorRest.DynamicPost("Erp.BO.CustShipSvc", "MarkShipmentLines", postData);

… then I run the ShipHead fix (where there are TWO ShipHeads) before the UpdateMaster …

var unmodifiedShipHead = ds.ShipHead[0];
unmodifiedShipHead.RowMod = "";

EpicorRest.DynamicPost("Erp.BO.CustShipSvc", "UpdateMaster", postData);

… this yields a Customer Shipment w/ a good header and detail lines that we can see in the Epicor Client. At this point none of the lines are closed or marked ReadyToInvoice yet; this is where the trouble begins.

So, the next step according to the tracelog is to set the ShipHead[0].ReadyToInvoice = true and ShipHead[0].RowMod = “U” property values and then the last UpdateMaster.

(BTW, we’re running the UpdateMaster calls with all the same boolean values found in the tracelog). In this last case, they are all True except for the doLotValidation param.

When I make this call this morning on this new test, I get a new message that I haven’t seen in previous tests:

"Message": "Packing Slip is not open. Cannot update.",
  "Type": "Error",
  "Table": "ShipDtl",
  "Program": "Erp.Services.BO.CustShip.dll",
  "Method": "ShipDtlBeforeUpdate"

In an effort to self debug, I re-ran the above test on a brand new order (exact copy) but this time, at the end before the last UpdateMaster I called GetById to load a clean object. Then I set the SH.ReadyToInvoice = true, SH.RowMod = U properties, and then called the final UpdateMaster and got a reply back:

Value cannot be null.
Parameter name: fromItem"

… and when I try to find the PackNum that was generated I see that it’s been deleted! AND it created a new incremented PackNum. Neither of which are linked to the Sales Order.

So while Customer Shipments are being created, we can’t find a way to link them successfully to the SalesOrder nor mark them ReadyToInvoice.

So that’s a lot of detail. I hope it helps shed some light?

Hi Jeff,
So i tried this exact same scenario in Postman and directly in the REST Help page and got the same result. It deletes the pack completely…

So looks like set ready to invoice… in REST is broken…

One option is to fix this with either a function or a baq that does this final step for you. I’ll keep investigating to see if a work around can be found.

I’ve tried every trick in the book with no luck. I think your only option here is to move this last call to a server side function or UBAQ.
(Or switch away from REST all together)

Make sure you submit a ticket so @Olga and her team can make sure it get’s handled.

Too much invested in the REST solution – our entire ecommerce integration and operations is using it. So I’m stuck with it getting fixed or going the server side route with a REST call to it.

If that means Epicor Functions, since I don’t have any experience with that, what would be my fastest option to get someone to help me complete this step?

And even when written, @josecgomez can I still use your same REST client to call it for that purpose?

Thanks for all the input thus far. :+1:

Yes you can still use REST client to call a Function and or a UBAQ…
What version of Epicor are you working with?
Cloud? Host? Multi Tenant? In house?

Ok, great.

We’re Cloud… version 10.2.600.5 … Geeze, had to hunt that down… with the recent Kinetic client they made it VERY INCONVENIENT to locate your client and connected server information. :face_with_symbols_over_mouth: Not available from the home page anymore.

Public cloud? or hosted somewhere?

Epicor Public Cloud…

Got it, let me see if I can throw a quick function together, stand by

1 Like

Woot! Thanks for all your help to date. If you’re ever down in Orlando, lunch/dinner on me! :grin:

Yes this is good question for support

Ok so you’ll need a function and a UBAQ because V1 of REST does’nt support direct function calls…
Both of these are attached
CustShip.efxb (23.6 KB)
Ship.baq (48.0 KB)

You’ll need to import the function first, then the BAQ.

Dictionary<string, string> dic = new Dictionary<string, string>();
            dic.Add("PackNum", "293");
            dynamic paraData = EpicorRest.DynamicGet("BaqSvc","Ship", dic);

This is the REST Call to make

NOTE I am providing these as is I can’t be responsible of your crap blows up, use at your own risk. Try it in TEST or PILOT first. Seriously… as the “kids” say these days don’t at me bro

I don’t know how or if these will work on the public cloud since they have a lot more restrictions. But I’m hoping it will.

FWIW the issue is definitely the Before Image (BI) issue outlined before even using a BPM Widgets it didn’t work had to specifically clone the row and do the BufferedCopy stuff before it would work.

Here’s how the function looks like

And the code it executes

var currentRow = this.dss.ShipHead[0];
    var newRow = this.dss.ShipHead.NewRow();
    BufferCopy.CopyExceptFor(currentRow, newRow, "");
    currentRow.ReadyToInvoice =true;
    var shipDs = this.dss;
    uf.UpdateMaster(ref shipDs,true,true,false,true,true,true,true,this.packNum, currentRow.BTCustNum, out opReleaseMessage, out opCompleteMessage, out opShippingMessage, out opLotMessage, out opInventoryMessage, out opLockQtyMessage, out opAllocationMessage, out opPartListNeedsAttr, out opLotListNeedsAttr, out shipCreditMsg, out cError, out compError, out msg, out opPostUpdMessage, out updateComplete, out checkComplianceError, out changeStatusError, out checkShipDtlAgain);

Please use the Feedback feature in kinetic to provide that feedback to them.

@josecgomez Thanks! So I would run my normal code (all the way up to the first two UpdateMaster calls) and then call this is to Function to set the final ReadyToInvoice step. Got it. I’ll give it a go.

Thanks again. I’ll loopback on my results.

1 Like