Can I get Workflow to automatically send data through different templates?

We currently have about a dozen different letter templates that are processed using the same csv datamapper but we’re currently using one workflow for each template. When we first produce the data report there is one ‘code’ field in the created csv that indicates which of the templates to use, and we currently split the data manually using that field, save the data for the different 'code’s into different csvs and drop the split data into the corresponding Hot Folders so that it will process it through the correct template.

Is there any way of getting workflow to pick up the data in that ‘code’ field and then split the data to feed through several different templates, so that we could just use one workflow process for the whole batch? There’s an OL Connect step called ‘merge jobs’ which I figured could be used after the data had been processed to the correct templates but I can’t see how I would split the workflow in the first place.

Thank you,
Lisa

Here what you should do instead:

Grab the CSV and perform the data mapping for the entire file. Make sure your data mapping config extracts that “code” field (let’s say it’s extracted under the name “code”). Also, make sure the data mapping task is set to “Output records in metadata”. This way, the Workflow metadata will “know” which records contains which code after the operation completes.

Add a Metadata Sorter task to sort each document based on the _vger_fld_code field.

Add a Metadata Sequencer task. Set it to sequence on the Document level and specify a rule for when the _vger_fld_code’s value changes.

So at this stage, the sequencer is set to "view " only batches of records that have the same code and to loop through all successive batches. The trick is now to dynamically call your Template according to the code.

The easiest way to do this is to name your templates exactly the same way as they are written in the Code field of your CSV. So for instance, if the field contains value “MyCodeForInvoice01”, then the Template you want to call should also be called “MyCodeForInvoice01”. That way, when you call the Content Creation task, you can use the “Dynamic” option (second from the top) to pick and choose the proper metadata field (and append “.OL-template” to it). The name will probably look something like this:

GetMeta(_vger_fld_Code[0], 10, Job.Group[0].Document[0]).OL-template

That should do the trick.

Perfect! I had a bit of trouble with this method at first as Workflow was getting confused just by me selecting ‘Output records in metadata’, but I finally realised that its issue was that I had spaces in some of my field headers. I amended the datamapper to take any header spaces out (and updated the templates accordingly) and it now works perfectly. Thank you!