Is there a way to iteratively populate a field group?

I am working on a workflow to deal with a customer’s accounting needs. We are using the JSON Web Service Datalink to grab data out of their PO software. I’m trying to figure out the bit where we can pull in n number of lines. Some POs only have one line, some have ten, and so on.

I’m trying to do a workflow where it will repeat a task n times, where n is the number of records in a PO (records = items that have been bought). I’ve figured out how to loop the whole workflow n times, but the bit I’m stuck on is how to choose which row of a field group to populate during the loop. For instance, the first time the datalink is run, it populates row 1 with record 1. On the next iteration, it populates row 2 with the 2nd record. On the 10th time, it populates row 10 with the 10th record, and so on.

I basically need to increment the “row number” of the field group every time the workflow loops, and I can’t figure that part out. It may not even be possible, from what I can see.

For those wondering “why don’t you just pull all the data overall and query it” - good question. I’ve just been told to try and do it this way. I think it’s due to the format the JSON data is in - if we pulled all of it, it’s a bunch of nested data, but if we pull only a specific bit (i.e. one record at a time), it’s just a string which is easier to handle.

If you use a count on the rows, then add 1 with math you can set the row number.

Append on a set field group task could add each row of data.

I will give that a shot, thanks!

Just to expand on this, I’m populating a parent field group fine, but I’m also populating a sub group related to the line I’ve adding in the parent field group. ECM is not associating the added sub group line, with my parent field group line? Parent field group and sub group id fields are correct for linking. Anyone come across this issue?

Depending on how you are populating the child field group, you will have to run the Create Subgroup task afterwards. If you make changes to the child field group, it will likely have become its own field group, disassociated from the parent.