Creating a workflow script subroutines

Create the workflow integration script subroutines.

About this task

The workflow script's subroutines are responsible for adding logic to the workflow's tasks. In this procedure, you configure subroutines to either log a message or write it to a text file according to the user input. This procedure uses the IBM RPA Studio's Designer tab.

Procedure

Defining the start_message subroutine logic

  1. Insert the Set Variable (setVar) command.
    1. In the Variable parameter, select the ${startMessage} variable.
    2. In the Value parameter, type "Type 1 to log the message in a message box or type 2 to log in a text file".
    3. Click the Save button.
  2. Insert the Input Box (inputBox) command.
    1. In the Title parameter, type "Hello World".
    2. In the Prompt parameter, select the ${startMessage} variable.
    3. In the Text output, select the ${helloWorldType} variable.
    4. Click the Save button.

Defining the hello_world_message subroutine logic

  1. Insert the Input Box (inputBox) command.
    1. In the Title parameter, type "Hello World Message".
    2. In the Prompt parameter, type "Type the message to be logged in the message box".
    3. In the Text output, select the ${helloWorldMessage} variable.
    4. Click the Save button.
  2. Insert the Show Message Box (messageBox) command.
    1. In the Title parameter, type "Message".
    2. In the Text parameter, select the ${helloWorldMessage} variable.
    3. In the Icon parameter, select the Information option.
    4. In the Buttons parameter, select the OK option.
    5. In the Default button parameter, select the First button option.
    6. Click the Save button.

Defining the hello_world_file subroutine logic

  1. Insert the Get System Folder Path (getSpecialFolder) command.
    1. In the Folder parameter, select the Desktop option.
    2. In the Path output, type "desktopPath".
    3. Click the Save button.
  2. Insert the Create Directory (createDir) command.
    1. In the Path parameter, type "${desktopPath}/Hello World File".
    2. In the Directory output, type "fileDirectory".
    3. Click the Save button.
  3. Insert the Input Box (inputBox) command.
    1. In the Title parameter, type "Hello World Message".
    2. In the Prompt parameter, type "Type the message to be logged in the text file".
    3. In the Text output, select the ${helloWorldFileMessage} variable.
    4. Click the Save button.
  4. Insert the Write to File (writeToFile) command.
    1. In the Content parameter, select the ${helloWorldMessage} variable.
    2. In the File path parameter, type "${fileDirectory}/helloWorld.txt".
    3. In the Encoding parameter, select the Operating System Default option.
    4. Click the Save button.

When executing the script, the workflow process will execute once for each instance create and you can test both cases of this log message workflow example.