Hello all,
Just wanted to share a bpm I made that is super simple and shows a decent way to use some of the BPM setters like fill table by query and set field. If anyone has any suggestions to make it cleaner/perform better, I am welcome to any feedback! I have come a long way in my epicor journey over the past year and wanted to share this customization for others to hopefully use as a template to update a field from any table in epicor.
To explain what this does, the BPM updates the comment field in purchase order entry with the purchasing comments listed in part entry. Since I wanted the BPM to trigger after a part was entered on the part detail line, I created the BPM as a Post-Process under the ChangeDetailPartNum BO which I figured out using the tracing options. The reason I did this is because by default epicor only pulls the comments for stock parts, but my purchasing team needed the comments for non-stock parts as well.
SO, first off, I created a condition that is true when the purchasing comment field is empty in purchase order entry because that is when I need this to trigger. If the comment under the part is also blank, this BPM will just ignore it and close out
Next, I created a variable that acts as a table set to hold the data in, in this case I used the POTableset type, but I am sure there are other types I could use. I did this to hopefully ignore any issues with updating the entire ds.podetail table, but it might not be necessary? If anyone wants to correct me feel free.
Then I made my Fill table by query, here I added the ds.podetail table to hold the data and the ERP.part table which I am passing data from. Since I want to ignore the logic in the podetail comment text field I want to grab it directly from the part table (this also means you can copy this logic and grab data from any other table in the system that isnt referenced by the BO you are using). For the display fields I only need the one I am updating from the part table since we are only passing the one field to the temporary tableset variable we made previously.
After that I updated the POdetail table inside the temp tableset variable we created, and set the mapping only to have the commentText field equal to the field from the part comment field directly. Since its a temp table I dont have to worry about any of the joins you would normally have to so I can ignore company and part joins like I had to configure in the BAQ
Last step is to set the field we want updated to the field we have saved in our temp table, so I set the ds.POdetail.Commenttext field to the expression partcommentrecordPODetailsROw.CommentText (temptableset field under the correct table, but techincally any table with commentText would do)which I was able to reference using the available variables which is epicors way of suggesting C# code. (you can ofcourse update a whole table instead of just one field, or multiple whatever works for your situation)
Keep in mind I think this only updates because another BO in order entry is calling for the same ds.POdetail table when you switch to the comment tab, so you might need to add a BO call in the BPM to get this to function sometimes. Hope this helps demystify creating BPMs and having them reference epicor’s sql entries. I had a difficult time finding many resources about how to use setters so I hope this helps my fellow epicor devs with a little less experience like myself !