I have a requirement from my users for a button that will walk through a job’s assemblies and subassemblies looking for all “Fitting” operations and insert a “Detail” operation just before it, if there isn’t one already. I’m able to walk the job and find what I’m looking for but, when I try to insert the new operation using the JobEntryAdapter.JobEntryData.JobOper.AddJobOperRow() method followed by a call to AcceptChanges() then Update(), I get “false” as my return, the record is of course not added, trace shows nothing, and I have nothing to explain the why behind this failure.
I’m new to ERP and Epicor, so I realize I may be approaching this all wrong, but so far I haven’t been able to find anything that points to “the right way” to handle such an operation. To that end, any help would be appreciated.
You should call the Business Objects and not manually add a row to the JobOper Table. TableSet.
You should use the JobEntryAdapter.GetNewJobOper() method.
Use Tracing to figure out which methods you need to call then mimic that in the adapter.
Ok Jose, I’ve been trying to use the JobEntryAdapter.GetNewJobOper() as you’ve recommended and I’ve made sure that I’m doing the same things I’m seeing in the trace log. The new Op is created in memory, but it will NOT save it to the Job. Given that the JobEntryAdapter.Update() only returns a bool and that is the only indication I’m getting of failure besides the Op not being there when I call JobEntryAdapter.GetByID() the next time, I’m at a lose. Below is the entire code I’m trying to execute. Maybe you, or anyone else willing to help, can see what I’m overlooking.
Probably oversimplifying here… but there are three steps:
Get new, which creates the new record in memory
populate the new record in memory
call the Update method, which writes the data back out to the database.
to find all the method calls, it is best to turn on tracing, perform what you want to do manually with normal Epicor interfaces, and see which method calls are used… then emulate the same thing.
Also, what you are describing may be best to be done with a BPM.
@josecgomez and @timshuwy
Ok gentlemen, since Tim’s mention of using BPMs to accomplish adding an operation, I have been trying to get my head around creating a BPM for deleting specific operations. Since this “delete” issue is related to the “add” described here I’m not sure if making a new Topic for this makes sense. Since my last entry on this Topic I’ve come to better understand what my user is doing and so would like to start over explaining my issue.
When the user starts a new job that contains similar assemblies to a previous job, they use Job Entry form’s Engineering -> Methods -> Job tab to open the old job. From there they drag the desired assemblies into the new job, firing the InsertBOMAsm() method. These older assemblies sometimes contain operations which are no longer used and thus need to be deleted. Some of these assemblies are missing a new operation that we’ve since added. When there are one or two assemblies its no big deal to remove them one by one. For larger jobs this makes for very tedious work that reduces how much data entry time was saved by importing.
So that said and considering Tim’s BPM suggestion, I am trying to write a BPM that would be associated with the InsertBOMAsm() method and handle the removal or addition before the records added to the new job. My problem now is that while I can find lots of examples of firing off an email or logging to a table, I haven’t had any luck finding an example of a BPM that removes or adds records to the data before proceeding with an operation. Any suggestion on where to look would be appreciated.
You will need to make your BPM a post processing BPM. This is because you need to process your delete after the record has been created.
Do another trace, and manually delete one of the Operations that you want to be deleted. Your post processing BPM above, will need to do this same process against the operation. Your biggest challenge will be to figure out under which conditions you need to delete an operation.