Copying and Reusing Task Steps |
In computer programming, the reuse of code is a common technique used to save time, reduce redundancy and eliminate errors by applying the same segment of code in multiple applications. The Task Builder plays a similar role by allowing task steps to be copied and re-used within the same task or across multiple tasks. This article describes various methods to perform this operation.
Copying Task Steps
The Home tab of the ribbon contains clipboard commands that allow you to reuse steps within a task by copying one or more steps and pasting them onto another section of the task. Because more than one instance of Task Builder can be opened simultaneously, code reuse can be performed across multiple tasks as well. The Copy command, in effect, copies the .AML code associated to each task step. This code can be pasted onto a specific step on the same task or another task using the Paste command. Alternatively, a Copy > Description command is available, allowing the textual description of each step to be copied and pasted onto another application outside of Task Builder, such as an email message or text file.
To Copy and Paste Steps in the Same Task
- Select the task you want to work with to open Task Builder.
- From the Steps panel, select the steps you wish to copy. To select a group of steps, hold down CTRL during selection. Use CTRL+A to select all.
- On the ribbon, select the Home tab and click the Copy button from the Clipboard command group. Or, right-click the highlighted steps and select Copy from the context menu.
- From the Steps panel, select the step you want to place the previously copied steps. Then, on the ribbon, select the Home tab and then click the Paste button from the Clipboard command group.
The copied steps are pasted precisely at the step you selected. Existing steps are moved directly below the pasted steps.
To Copy Steps from One Task to Another Existing Task
- Select the task you want to copy steps from in order to open the first instance of Task Builder.
- Select the task you want steps to be pasted onto in order to open the second instance of Task Builder.
- From the Steps panel in the first instance of Task Builder, select the steps you wish to copy . To select a group of steps, hold down CTRL during selection. Use CTRL+A to select all.
- On the ribbon, select the Home tab and then click the Copy button from the Clipboard command group.
- From the Steps panel of the second instance of Task Builder (the one you wish to paste steps onto), on the ribbon, select the Home tab and then click the Paste button from the Clipboard command group.
The copied steps are pasted precisely at the step you selected. Existing steps are moved directly below the pasted steps.
To Copy Steps from One Task to a New Task
- Create and edit a new task to open an instance of Task Builder.
- Select the existing task you want to copy steps from to open another instance of Task Builder.
- From the Task Builder's Steps panel of the existing task, select the steps you wish to copy . To select a group of steps, hold down CTRL during selection. Use CTRL+A to select all.
- On the ribbon, select the Home tab and click the Copy button from the Clipboard command group.
- Select the Task Builder instance associated to the new task.
- Right-click anywhere inside the empty Steps panel and select Paste from the context menu. The copied steps are pasted directly onto the Steps panel of the new task.
To Copy and Paste Step Descriptions
- From the Steps panel of Task Builder, select the steps in which to copy the description from. To select more than one step, hold down CTRL during selection or use CTRL+A to select all steps.
- From the ribbon interface, select Copy > Description from the Clipboard command group or right-click and select Copy > Description from the context menu.
- The text can be pasted into any Automate field or text-box where plain text is accepted. You can also paste copied steps or step descriptions in other documents such as email messages or text files.
- When Copy> Description is selected, the content of the clipboard becomes populated with the “Visual View” text-only description that is normally displayed in the Steps panel and does not contain any AML code (even if the Steps panel is currently set to be viewed in AML format).
- To copy the AML code of a particular step instead of the text description, select Copy from the ribbon interface or right-click the step and select Copy from the context menu (not Copy > Description). Doing so will allow you to paste the AML code into a document, text file or any field in Automate that accepts text.
- Selecting Copy will also allow you to paste the content as a step in the Steps panel.
Saving a Copy of a Task
Steps of an existing task can be re-used in a newly created task by selecting the Save Copy As command. This is an ideal method for copying all of the steps of an existing task onto a new task.
To Save a Copy of a Task
- Open the task you wish to copy steps from by doing
one of the following:
- From Task Administrator, right-click the task and select Steps. The Task Builder appears for this task.
- Select the task from the Repository section of the Server Management Console or Workflow Designer. A separate instance of the Task Builder appears for each task.
- If a new (unmanaged) task was initially created by directly opening the Task Builder from the Start menu, select Open from the Application menu and navigate to the task (.AML) file you wish to open and click the Open button. In this case, a separate tab appears in the Steps pane of the Task Builder, each signifying an open task.
- From Task Builder's ribbon interface, select File > Save copy as.
- Navigate to the desired location, enter a name for the new task, and click Save.
Using Snippets
Another way of using a group of steps within a specific task is to save the steps as Snippets. Snippets provide an easy way to implement frequently used code into a task. They are particularly useful to those who use specific activities that contain commonly used properties or settings. Instead of re-entering the properties for a specific activity or series of activities every time they're added as task steps, users can save existing steps as a snippet and simply drag and drop the snippet wherever it is needed in any task.