I am developing a custom web app for my company to streamline some parts of our workflow. One of those workflows is part creation, which I have made a tool for using methods in Erp.BO.PartSvc.
The tool works well for any standard (non-painted) parts that we enter into the system. Our painted parts follow a schema like {partNum}+{paintCode}.
With the web app tool implemented, I’ve run across some issues when creating these painted parts, and I believe that the issue is the plus sign (+).
For the most part, the REST API is able to drop in information where necessary, but it doesn’t seem to like updating tables like PartPlant or PartRev. This is only ever an issue on these painted parts. I have tried to update these parts directly from the Swagger UI and I usually get a 400 or 404 error.
I’m usually able to pull the data that I need, but updating is the bigger issue. I have defaulted to using Erp.BO.PartSvc/Update where other methods don’t work, but I cannot get around the plus sign issue. Most GET methods also cause a similar issue when using a plus sign. It seems like Swagger encodes the plus sign on its own for any URL parameters, but it still wont give me a successful response.
I’ve also tried to encode the plus sign in my JSON string or URL param but the issue remains.
Does anyone have any experience with issues like these? Any help is appreciated.
I would recommend you use a Function for all your CRUD operations plus sign does need to be encoded in a GET Request since the browser will interpret that funny.
I would need to get the Update method working properly in Swagger before writing a function for it though right?. I’m able to get the part data from Erp.BO.PartSvc/GetByID
But updating by using Erp.BO.PartSvc/Update (or any other) just doesn’t work.
I understand the comment about not using plus signs but this is a long standing schema not established by myself that would be difficult to change.
What Jose is suggesting is to NOT use PartSvc but to create an Epicor Function where you get to declare the parameters. You would pass in the Part and Color parameters separately over REST then call the Part BO at the server, have it build the part number, and avoid the encoding problem entirely.
If you’re familiar with Data or Method Directives (BPMs) then Functions are a piece of cake. If not, I would get aquainted with the User Guide and learn about both.
BTW, the RPC methods listed in the Swagger page are identical to what you would call in a directive or function. If you’ve been only using OData, then it will be a little different.