OL Learn

How to use runtime parameter in job preset

Can someone write simple example how to use runtime parameters in job preset. User guide is not very helpfull.
If I understand correctly I should be able to pass workflow parameter to job preset and use it in external sort program. I tried to add one parameter in job preset with same name as one in workflow but it does not work.

Alright, so let’s assume we want to pass some information into the form that will be used to name the final output file. I want a single PDF out that contains all records, but has a name prepended to it from the workflow.

You’ll set up your Data Mapper and Template as normal. Then in your Job Preset you’re going to need to do two things:

  1. Configure the Runtime Parameters
  2. Configure Metadata

In the Runtime Parameter Options, you’re going to create a new Parameter (green plus) and give it some name. You can also define a default value if you so choose. For our purposes here, a simple String type will suffice. I’ll name mine outputName

Next in the Meta Data Options, we’ll create a tag that references this parameter. Since I want a single file out, I’ll need to add this tag to the Document Set. Click the green plus and choose ‘Add runtime parameter meta data’. You’ll be presented with a list of all the parameters you’ve defined in the previous step.

That’s it for the Job Preset. Over to the Output Preset.

Since that parameter has now been added to the metadata, adding it to the name is no different than any other metadata. We just need to set the separation to Document Set and we’ll be able to access our value like so: ${set.metadata.outputName}. We’ll just send that to a directory and we’re done with the output preset.

Send them all to the workflow and set up a standard Connect job (Data Mapping, Print Content, Job, Output).

Now that you’ve got a job preset that’s got Parameters defined in it, the Parameters become available for editing in the workflow:

I’ve typed a static name here, but you could just as well pass workflow variables or job infos into this, or any other data selection available in the Workflow.

That’s it. My file is now output to the directory chosen in the output preset with my very creative filename.

As a further note to this, once the job parameter is defined in the job preset, it can also be used to dynamically drive things like filtering. For example, I could set up my filter to compare the State listed in my data mapping to a value from the workflow so that I can filter my output based on a workflow variable.

This would allow you to have a single job preset that is capable of handling a more dynamic work load.

Now, this is what I call helpful.
User guide is missing part where we should add runtime parameter in Create Job. I added that parameter and now external sorter gets new data. Still there are few bugs with this option that stops me from using it.

I want to send location of config file to sorter, for example “C:\olconnect\mergeTicket_3\sorterConfig.json”. First part “C:\olconnect\mergeTicket_3” is stored as local parameter named workingFolder, so I constructed entire path in Create Job properties like this

This looks fine, so I clicked OK, closed window, started job and ERROR. When I opened this window again I saw that one backslash was missing.


Without any change I clicked OK again, and reopened same window again. Now the second backslash together with letter s was missing.


This is first bug and I hope it will be fixed eventually.

Since I don’t have time to wait for that I tried to create full path in script and pass entire variable without any modification in this windows. I created local variable named sorterConfigFile, updated Runtime parameter, started job and ERROR.

this is log from workflow

variable sorterConfigFile was construced in script
DEBUG: 23:37:13.137 [0024] — sorterConfigFile: C:\\olconnect\\mergeTicket_3\sorterConfig.json

DEBUG: 23:37:13.138 [0026] Runtime Parameters JSON: “parameters”:{“sorterConfigFile”: “%{sorterConfigFile}”,}
DEBUG: 23:37:13.138 [0026] Parsed Runtime Parameters JSON: “parameters”:{“sorterConfigFile”: “C:\\olconnect\\mergeTicket_3\sorterConfig.json”,}

and this is log from server

[2020-03-10 23:37:13,156] INFO [OC-682792901] com.objectiflune.serverengine.rest.workflow.JobCreationRestService.call(k.java) Starting Job creation (Se_508)

[2020-03-10 23:37:13,157] INFO [OC-682792901] com.objectiflune.jobcreation.service.impl.JobCreationServiceImpl.a(JobCreationServiceImpl.java) Processing external sort

[2020-03-10 23:37:13,290] INFO [OC-682792901] com.objectiflune.jobcreation.service.impl.JobCreationServiceImpl.a(JobCreationServiceImpl.java) Running: c:\olconnect\TPC.ConnectSort\TPC.ConnectSort.exe “C:olconnectmergeTicket_3orterConfig.json” “C:\Users\pres_connect\Connect\temp\Server\5108\input4575556974925581197.csv” “C:\Users\pres_connect\Connect\temp\Server\5108\output3160205050371379016.csv”

As you can see all backslashes were removed from this parameter. No mater how many backslashes I add, they are all removed before external sorter gets called.

Does anyone have an idea how to pass filename to external sorter?


Yeah, looks like there might be a bug there. I’m getting the same thing in Workflow if I pass a path in like you’re doing. Put in double slashes, hit OK, reopen the Job task, and one of the slashes is gone. Close and reopen and both are gone.

Considering, however, that the path is destined for use in javascript within Connect, you should probably be formatting your path the way javascript would expect. That is to say, C:/Parent/Child/Document.txt. That seems to be giving me better results.

Looks like this’ll be fixed in the next version.