2.4 Creating an action flow
You can create a job that contains action flows. This section describes how to combine standard provided action items to create an action flow that executes three actions: (1) creates an executable file, (2) checks whether the file exists, and (3) displays Success! when the file exists or Failure! when the file does not exist.
The following figure shows the processing flow of a job that contains an action flow.
|
The first action creates a file named hello.txt by using the echo command (cmd.exe /c echo "hello" >c:\temp\hello.txt).
The second action checks the file by using the if command (cmd.exe /c if not exist c:\temp\hello.txt exit 1). This command will end with the return value of 1 when the file does not exist. Subsequently, when the file does not exist, the action displays a message dialog box by using the msg command (msg.exe console /w Failure!). Then the action ends with the return value of 1.
The third action displays a message dialog box by using the msg command (msg.exe console /w Success!).
Procedure
-
Start the Job Design View, and then select the Action flow tab.
-
Click the
(New) button.
The Action flow dialog box appears.
-
Enter the item name and description.
- Example
-
Item name: Hello Check
Details: Check whether the file hello.txt exists.
-
Create the first action to create a file.
In the Action tab, select the Command execution item, and then drag the item to the Flow map area. When the item is placed in the Flow map area, the Unit dialog box appears.
-
Enter the unit name, execution command, parameter and virtual user name of the action, and then click the OK button.
Note that unit names must be unique in an action flow.
- Example
-
Unit name: make file
Execution command: cmd.exe
Parameter: /c echo hello! >c:\temp\hello.txt
Virtual user name: Virtual user name#
- #
-
If you want to execute the command as a specific Windows user, specify the name of a virtual user associated with that Windows user. If this is omitted, the command is executed with the account for the CPA job execution service. For details on the virtual user name, see the manual JP1/Client Process Automation Configuration and Administration Guide.
-
Create the second action to check the file.
In this step, use an item that can run a recovery execution command when the execution command fails.
Drag the Command execution with recovery option item to the Flow map area in the same way as in step 4. When the item is placed in the Flow map area, another Unit dialog box appears.
-
Enter the unit name, execution command, parameter and virtual user name of the action, and then click the OK button.
- Example
-
Unit name: check file
Execution command: cmd.exe
Parameter: /c if not exist c:\temp\hello.txt exit 1
Recovery execution command: cmd.exe
Parameter for recovery execution command: /c msg.exe console /w Failure! & exit 1#1
Virtual user name: Virtual user name#2
- #1
-
If you want to run the recovery execution command in a 64-bit operating system, specify the parameter for the command as follows.
When the installation path of the Windows system is C:\Windows:
/c c:\Windows\sysnative\msg.exe console /w Failure! & exit 1
- #2
-
If you want to execute the command as a specific Windows user, specify the name of a virtual user associated with that Windows user. If this is omitted, the command is executed with the account for the CPA job execution service. For details on the virtual user name, see the manual JP1/Client Process Automation Configuration and Administration Guide.
-
Create the third action to complete the file.
Drag the Command execution item to the Flow map area in the same way as in step 6. When the item is placed in the Flow map area, another Unit dialog box appears. Enter the unit name, execution command, parameter and virtual user name of the action, and then click the OK button.
- Example
-
Unit name: complete
Execution command: msg.exe#1
Parameter: console /w Success!
Virtual user name: Virtual user name#2
- #1
-
If you want to execute the command on a 64-bit operating system, specify the command as follows.
When the installation path of the Windows system is C:\Windows:
C:\Windows\sysnative\msg.exe
- #2
-
If you want to execute the command as a specific Windows user, specify the name of a virtual user associated with that Windows user. If this is omitted, the command is executed with the account for the CPA job execution service. For details on the virtual user name, see the manual JP1/Client Process Automation Configuration and Administration Guide.
-
Draw a relation line between two units to define the order in which the actions will run.
Click the first unit make file, and then click the second unit check file.
-
Draw a relation line between the second unit check file and the third unit complete.
Draw a relation line in the same way as in step 9, and then click the Register button. A message appears, indicating that registration is completed.
-
Check the information in the message dialog box, and then click the OK button.
Now the action flow is created. Next, let's register a job.
For details on how to register a job, see 2.2 Creating a job.
-
Return to the Job Design View, and open the Job exe. on time dialog box.
Under Select item, you find that the Action tab contains the Hello Check item you created.
-
Enter the job name and description.
- Example
-
Job name: TEST02
Details: Hello Check
-
Select the item, and then click the Apply button. This sets Execute action to the item.
-
Click the Register button.
A message appears indicating the completion of the registration.
-
Click the OK button.
Now the job is registered.
- Organization of this section