I just did something similar, doing a labor adjustment with a BPM, but I took a different approach. Even though I knew I could write it in C#, I decided to do it all with Widgets.
add widget 2 Invoke BO Method… inside that define the method, and the variables. It automatically will create the needed variables for you (after you give them a name)
Add widget 1 to “fill” the newly created variable for the LaborDtl record with the new adjustment you want.
connecct the two widgets…
Note that filling the LaborDtl requires all the necessary data. Some can be hard coded, some can come from other variables or BPMContext variables.
So the timing of you posting this is perfect as we were just in the middle of trying something similar. We have very large assemblies, and our supervisors, at certain points, have the need to go through multiple jobs and close operations (10-15 at a time, over multiple jobs) to ensure things are moving along in the system. We made a dashboard that focuses on JobOper that enables them to close the operation (which moves the item along in peoples work queue) but I would also like to create a “job Adjustment” at the same time so that when we look through the labor transactions we can see that the operation was closed by the supervisor.
I believe that we can use your code (which slight adjustments) but am stuck as to the best place to place the BPM to get it to fire when we want it (I have created a UD field in the labordtl table that is the “Operation Closed Override” checkbox that would be Condition trigger in the BPM…
BIG NOTE HERE: Job Adjustments are “not quite” the same as regular job completions. I found that if you do a job adjustment to finish the final operation on a job, ALMOST everything is the same… parts backflush, job shows that a quantity is completed… all good…
BUT, if the job is Make Direct, “Normally”, when you complete the final operation, the PartAlloc table is updated showing that the job’s parts are allocated to the sales order release… but for some reason, adjustments do not do this. I have NOT tried “Auto Receive” but it might have the same issue as well.
So all of these bindings are required when updating the LaborDtl Table? If so how would you handle the LaborHeadSeq, LaborDtlSeq, SysRowID, RowID and other system generated fields if there is NOT already a LaborDtl row cretaed? Or is this even possible?
You would need to make a new LaborDtl with the adapter which will handle the laborDtl Sequence, SysRowID and SysRev. You don’t need LaborHedSeq since this would be like a backflush not done by a clocked in employee.
ya-- you know what I was being stupid. My code was fine as far as the Job Cost adjustment. I was referencing and looping through nothing thinking I was working through “added” rows in a UD table. I guess the datasets and temp tables work differently on the UD table methods-- I couldn’t figure out how to access the temp table of rows so I just sent the row info for 1 row from the pre directive thru bpm fields.