Knowledge Base

How to invoke workflow with arguments from command line using UiLauncher.exe

Note: This is deprecated, for version 8.x and above check this article

A workflow can be invoked from command line using our UiLauncher.exe file. The command is:

UiLauncher.exe /file:"workflow.xaml" /input:"string_in_json_format"

The /file parameter stores the path to the workflow.
Let's take a look at the second parameter: /input. It is used when the invoked workflow requires input parameters. In this case, our workflow need to receive a json file containing the parameters we want to pass.

A json file encrypts data in a format like this one:

  "name": "John Smith",
  "isMale": true,
  "age": 20

and this is what we have to pass to UiLauncher.exe if we have, let's suppose, a workflow that has 3 input parameters name, isMale and age of type string, boolean and int.

The only thing is that the quotes needs to be escaped ( using \" ) when we pass it to command line so a workflow with these 3 params will be invoked like this:

UiLauncher.exe /file:"workflow.xaml" /input:"{\"name\" : \"John Smith\", \"isMale\":true,\"age\":20}"

UiLauncher accepts as input arguments through command line only standard types : string, int, bool. You should change your input argument of type DateTime to a string argument, and convert that string inside your workflow to a DateTime object.

Download here the attached sample.