Adding Scripts to Task Steps
Before you can write script to replace part of a selected task step, you must first determine which portion of the task step's execution you will be replacing. You can create script for these phases of task execution: recognition, outputs, inputs, transition, or table processing for parent tables.
||You cannot replace outputs and inputs with script when they are used in table detail or form steps. Outputs are also not available to replace with script when used in global screen handlers.
|To add script to your task step
- Click the icon in either the property or task step tree pane depending on the portion of the task step you are scripting.
Alternatively, you can access the script editor from the Step menu. Select Advanced and then choose Add Navigation Script.
- In the Script window, enter the script needed to handle the selected phase of the task execution. To create additional methods and inner classes for use with your script, use the Helper Methods panel of the script editor.
To aid in writing your script, use the advanced Java options, by clicking the appropriate node on the navigation pane of the script editor.
|Use this option
||To do this
||Declare the constants and variables you want to use in your script.
||Declare the helper methods, including method declarations that you want to use in your script.
||Add or remove the class and package imports that are needed by your script.
||Add or remove the external JARs you need to complete your script. The resources added here are available to all scripts used in the project.
Also, a list of variables, visible by default in the top pane of the editor, is available for you to use in your script. These variables are links to their appropriate Javadocs. Click Hide tips to remove the usage tips from the editor. You can display them by clicking Show usage tips at any time.
- Verify your script. The script editor, when it verifies script, checks the syntax of enabled script for possible errors. All script must verify successfully or be disabled before it can be used in your task step.
There are two methods available to verify your script:
|Click Verify Script
||Verifies your script without saving it. If the verification is successful, a message displays in the top pane of the editor.
||Verifies your script, saves the changes, and dismisses the script editor.
If verification errors occur, address each error by selecting it, and modifying the script. You can page through all the errors by clicking the navigation arrows in the top pane of the editor. You must either correct all errors or disable the offending portions of the script before you can save your script.
After completing the scripting process, test your task to determine that it is executing as you expected it to.
Click Disable the Above Script in Step Execution and click OK to disable the script written in the current panel and return to the original task step. The script is saved but will not be used during task execution. You can leave the editor without losing script that is not complete or ready to deploy. The script will be available for editing when you return to the scripting window.