I’m attempting to create a BPM that removes the primary bin from a specific warehouse when duplicating a part, but it’s not actually wiping the field. Did a trace, saw that the Part.DuplicatePart BO is firing, so I created a Post BPM with two ‘set field’ widgets and a message box (for PrimBinNum and PrimBinNumDescription). Message box shows up.
We’ve got two warehouses (INSP and IOWA), and the trace shows both sequentially in the data set. The BO is only triggered once. RowMod is blank.
I tried changing the SetField from a “” expression to a different BinNum, but the original still appears.
To top it off, Field Help shows PartWhse.PrimBinNum, which is in the BPM Dataset. Yet that field doesn’t exist when you look in BAQ - The PrimBinNum field is actually in the PlantWhse table, which is not in the BPM’s dataset.
I did find @alintzthread where he filled a temp table with all part details, and then called Part.UpdateExt to set the fields. Is that really required to clear out two fields? Seems like a Post BPM should be all that’s needed.
I set the PrimBin in a data directive on PlantWhse for our finished goods warehouse. I made a quick change in test and I can wipe the PrimBin on a duplicated part.
Note that the data directive is on PlantWhse, not PartWhse. Maybe that is a clue as to why the method directive doesn’t work the way we initially expect? I don’t recall the details.
Out of curiosity, has anyone adapted this to work in Kinetic? I’ve been trying and using ChatGPT to try to help me get on the right track and I keep getting close, but not exactly there. I was able to make it work for deleting Part Revisions with only 1 revision using C#, but I’d prefer to use the widgets to make it safer for upgrades. I can’t figure out how to convert the Part.Update or utilize Part.UpdateExt if that is the right one.
using a BPM is the best way to solve this all for today… BUT ALSO.. feel free to vote for Epicor IDEA: Log In - Epicor Identity which addresses both of these. I just got done merging several ideas together. 1 is to give an option when duplicating a part to not duplicate the revisions. Another is to not duplicate price lists, and still a 3rd is to eliminate the default bin when duplicating it.
I voted for your idea, but you are reminding me of this idea which I do not see merged into it. I have a comment there about revisions, if you are interested.
That idea is great @timshuwy and I put in my vote, but without knowing how long that might take to get implemented, can anyone review the code I have and see if there is anything I’m missing that would stop me from getting the following error:
“We apologize, but an unexpected internal problem occurred. Please provide your System Admin or Technical Support this Correlation ID for further details.”
I receive this error after duplicating a part with the below Post-Processing Method Directive C# code, deleting the new part number, then trying to create the same part number again. I’m figuring that without calling the necessary Business Objects, it is making some sort of orphaned link between the respective Part and PartRev tables.
try
{
// Create a detached list of revisions to delete
var revisionsToDelete = Db.PartRev.Where(r => r.PartNum == targetPartNum).ToList();
// Clear previous log
callContextBpmData.ShortChar01 = "";
int deleteCount = 0;
if (revisionsToDelete.Count == 0)
{
callContextBpmData.ShortChar01 = "No revisions found for duplicated Part: " + targetPartNum;
}
else
{
// Loop using index over detached list (safe for deletion)
for (int i = 0; i < revisionsToDelete.Count; i++)
{
var revision = revisionsToDelete[i];
Db.PartRev.Delete(revision);
deleteCount++;
if (callContextBpmData.ShortChar01.Length > 0)
callContextBpmData.ShortChar01 += "\n";
callContextBpmData.ShortChar01 += "Deleted Revision: " + revision.RevisionNum;
}
callContextBpmData.ShortChar01 = $"Deleted {deleteCount} revision(s) for Part {targetPartNum}\n"
+ callContextBpmData.ShortChar01;
}
}
catch (Exception ex)
{
callContextBpmData.ShortChar01 = "Error deleting PartRevs: " + ex.Message;
throw;
}
If anyone has a way to do this with the built-in widgets, I’d be all open to doing that method instead, but I can’t seem to figure out how to make it work in Kinetic either way.
Yes, in addition to removing any Supplier Price Lists and primary warehouses/bins, but I wanted to test one piece at a time. I was doing my due diligence on testing and just deleted the part after it was created, so I could reuse the same part number (easier to remember 1 part number instead of many attempts). This was primarily because my initial tests were not deleting the revisions. After I got a previous version of the C# code to delete a part with only 1 revision, I had ChatGPT help me with multiple revisions. That is when I started running into the issue. Whatever is happening with the deletion of the revision, I think it orphans something in one of the table references and won’t allow the same part number to be created again. With all that in mind, this (deleting a part and re-using the same part number) can happen sometimes (at least it has a few times within the company I work for in the 9 years I’ve been here), and I wanted to be ahead of the game on it.
Honestly I didn’t even check (in the trace) to see if both parts (new and old) are in the final dataset. The point here is that IF they are both there, it only deletes the revs of the new part. (Perhaps it is only the new part, and all that’s needed is just to set all to “D.” )
Tangent - this is the first I have ever actually used the Kinetic BPM designer to actually design a BPM.
The “Bind automatically” thing [IS FINE.] seemed to only do the first 80 rows. Feels like a glitch.
Here it was irrelevant, since I was concerned with doing two things: nothing, or delete. Either way, I don’t give a hoot if the temp dataset is accurate except for primary keys.
But if I was doing something permanent, this might be a problem.
[EDIT: see my comment 2 posts later. Binding automatically is fine. The BPM query seems to have grabbed only the first 80 fields when I checked “all” using the checkbox in the header and I had failed to verify that they all moved to the display side.]
That looks very promising, and I was trying that, but could not get it working when I tried it. Could you provide details on how your MyQuery is set up? I think everything else makes sense.