I’m attempting to write a BPM that fires when the AR invoices are posted.
In my tests, everything went well as I wrote a quick customization that would do a range of invoices. The issue I’m having is when I run a posting with the “live” version of the test I’m getting issues with “The table ttInvcHead has more than one record” and the BPM fails to fire. I thought I would attempt a TT join, but that lead to data duplication and slowing down the process.
The error is happening when I’m setting criteria for my queries from the ttInvcHead table.
I guess my question is: Is my only choice to write a custom code block that will fill the dataset with the information that I’m attempting to use “Fill Table by Query” to fill it with? I don’t see any way to loop in the BPM, and I need it to be flexible to handle single or multiple record updates.
foreach (var IH in ttInvcHead)
will do a loop through however mean there are.
That I understand. I was asking to see if there was another way to not have to do it via a code block. As soon as I introduce C# in the mix, it becomes very hard for anybody else here on prem to tweak my BPMs.
You can use the “Update Table by Query” widget to update the TT Record… in fact, that would be the preferred way if you can do it. You basically create a query that gets all the data you need to push to the tt records… then you update the tt records.
REMEMBER to setup the relation iside the “specified mapping” section of that widget… this is where you map the mutliple records to what was found in your query. Then you can bind all the values you want updated.
For some reason when I was doing the ttInvcHead to InvcHead join I was getting two results for one row. When I run the query in a BAQ or SQL it returned one row. If I added the invoice number to the criteria of ttInvcHead then I got only one row.
I was only posting one invoice with one line. I’m not sure why the join was causing a duplication. I just figured out how to look at the query from the .cs file. I’ll recreate it and see what it shows…
many times there ARE two rows… the unmodified row, and the modified row… you need to filter by RowMod = “U”…
OR manytimes, if I only want the MODIFIED or Added rows, I simply look for the RowMod <> “”
I am still new-ish at this. I e-mailed myself the data dump of the ttInvcHead and the dataset before and after the block. The ttInvcHead only showed the one row. I’m guessing it wouldn’t show all the rows? I had all of the added/modified/… checkboxes checked.