We’re using Epicor 10 ERP, and I’m trying to create a BPM that, when a user creates a new part, will create a folder on our server with the part number. I’m using the “Erp.Part.GetNewPart” method to trigger the BPM, and I’m using the “Execute Custom Code” option to execute the code and the “Show Message” to say the folder has been created.
The first code I used had only a generic create folder command:
This code failed to create a folder but the message did popup saying it was created, so I know the BPM triggered. So not sure why the create directory code didn’t work.
Next I changed the code to add the part number to a variable that would pass on to the folder name:
var folderName = Erp.Tablesets.PartTable.PartNum;
Directory.CreateDirectory(@“E:\EpicorTesting” + folderName);
Again the folder wasn’t created but I also got the following error regarding the PartNum field…
Details:
Error CS1061: ‘Erp.Tablesets.PartTable’ does not contain a definition for ‘PartNum’ and no extension method ‘PartNum’ accepting a first argument of type ‘Erp.Tablesets.PartTable’ could be found (are you missing a using directive or an assembly reference?) [GetNewPart.Post.CreateFolder.cs(93,25)]
Error CS0103: The name ‘Directory’ does not exist in the current context [GetNewPart.Post.CreateFolder.cs(94,1)]
Has anyone tried to do something similar before? Any help anyone could offer would be appreciated! Thank you for your time and have a great day.
Well the GetNewPartNum method will have no information about the PartNum you are trying to create.
You need to move your code to part.Update method where the data will be available.
Furthermore you need to read the data set in the ttPart table to get the PartNum
Thank you for your reply! I moved it to the part.Update method and used the “Execute Custom Code” option with the simple code: Directory.CreateDirectory(@“E:\EpicorTesting\TEST”);
I placed this in the Post-Processing first, enabled it and tested, but no folder was created. I did the same in the Pre-Processing area and still no folder.
It would seem I need to work out the folder creation process before getting to the reading in of the PartNum from the data set. Any suggestions? Thanks for your help!
That’s not going to work all BPM code is executed server side.
It seems to my they got you running before you can walk
I would highly recommend that you follow and read both of these guides before trying to create customizations, bpms, baqs, etc. It will clarify a lot of the fundamentals needed to ensure that your project is successful
I changed to a server location and it worked great. Yeah, I’ve only been working with Epicor for a few weeks now. Been going through their embedded courses and what I can find online. Thanks for the links!