Installing and Running
You can create DMScript Procedures and invoke them "directly" without the need to perform a deployment. You can use this to create test scripts so that you can get used to DMScript syntax and the capabilities of the language without the need to instigate a deployment.
To do this, perform the following steps:
- Select the "Flows" menu option along the top of the DeployHub Web User Interface.
- Select the "Functions and Procedures" tab on the explorer pane (tree view) on the left- hand side.
- Right-Click on the Domain where you want to create your Procedure.
- Select "New Procedure in this Domain" (or New Function if you want to create a Function).
- A pop-up box appears. Enter the name for your Procedure. For "kind" select "DMScript Procedure in Database" (or "DMScript Function in Database" if creating a Function). Pick a "Category" in which you want the Procedure/Function to appear in the action editor. You can type a new category name here to create a new category.
- Click OK to create the new Procedure/Function. The summary page will be displayed.
- Select the "Body" tab to select the DMScript body. This will be empty initially.
- Click the pencil icon in the top-right of the body pane to open the editor.
- Enter your DMScript into the editor. When you have finished editing the script, click OK. If there any syntax errors, these will be highlighted and the editor will stay open. Only if the DMScript is syntactically correct will it be saved and the dialog will close.
- Click on the "Actions" tab on the explorer pane (tree view) on the left hand side.
- Right-Click on the same Domain where you created the Procedure/Function.
- Select "New Action in this Domain".
- A pop-up box appears. Enter the name of an action. This action will be used to call the Procedure/Function you just created.
- Click OK to create the new action. The summary page will be displayed.
- Select the "Workflow" tab to select the Action Workflow. This will be empty initially.
- In the "activities" pane on the right-hand side of the Workflow editor, locate the Function/Procedure you created earlier. You may need to open the category in which you created the Function/Procedure.
- Drag the Procedure/Function on to the Workflow pane.
- When you drop the Procedure/Function a pop-up box will open asking you to give the activity a name and a summary. You can choose to put a name in here or not. If you don't give a new name the activity will be given the same name as the Procedure/Function. Just click OK to save the activity.
- The action will now consist of a single flow from the "Start" of the workflow to the Procedure/Function you created earlier.
- Click on the "Domains" menu option along the top of the interface.
- Ensure the "Domains" tab is selected on the Explorer Pane (Tree View) on the left- hand side.
- Select the same Domain in which you created the action and Procedure (or one of its sub-domains).
- Click on the "Tasks" tab on the main panel. This will show all the tasks that are available in the selected domain.
- Right click on a blank area in the "Tasks in this Domain" panel (i.e.: do not right-click an existing task).
- A pop-up menu will be displayed. Select "Add Run Action Task".
- A new task will be created. Click the pencil icon in the top right to edit the task details.
- Give the task a new name if required. In the "Action to Run" drop-down, select the action you created above.
- Ensure the "Show Output" checkbox is selected.
- Click OK to save the task.
- Drag "Everyone" (or an appropriate user group) from the "Available Groups" panel to the "Group Access" panel. This will ensure that the task can be executed.
You can now invoke the DMScript from different contexts:
- If you right-click on a Component and run the task, the selected Component is pushed onto the stack. You can access the selected Component via the $Component object.
- If you right-click on an Application and run the task, the selected Application is pushed onto the stack. You can access the selected Application via the $Application object.