When you write your own DMScript, you create custom Procedures and Functions that will execute the installation logic of your deployment. Procedures and Functions written in DMScript are created using external scripts. You can use DMScript to manipulate the following DeployHub Objects:

  • Application
  • Change Request
  • Components
  • Component Items
  • Credentials
  • Date
  • Domain
  • DropZone
  • DropZone File
  • Environment
  • Endpoint
  • User
  • UserGroup

DMScript is an object-orientated scripting language. As such, it understands each object in the DeployHub model. You can access each object either by selecting it off the stack (e.g.: $Environment), by retrieving a reference to the object from some other object, or by calling a built-in Function to retrieve it. Each object has accessible properties. Some objects also have methods that can be called.

Object Properties

A property is typically accessed like this:

set appid = ${Application.id}

which will return the internal object ID of the Application object. Note that when referencing a property, the property name does not contain ().

Object Methods

A method is accessed like this:

set descendants = ${Application.children()}

which returns an array of Application objects, representing the descendants of the specified Application. When referencing an object's method, the method name has (). Methods are normally used when there is an optional or mandatory parameter that can be passed to the method to control its operation. In the above example, children() has an optional Boolean parameter which controls how many descendants are returned in the array.

Storing DMScripts

When you write your own DMScripts for Procedures and Functions, you can set the "kind" to either "DMScript Procedure in Database” or "DMScript Procedure in Repository".

DMScript Procedure in Database

If the "kind" is "DMScript Procedure in Database" then a "Body" tab will appear. This will show the text of the DMScript. Clicking the pencil icon will open a pop-up editor. This editor has syntax highlighting, search and replace options (including searching for regular expressions) and other editor Functions. When the edited DMScript is saved (by clicking the OK button or the save icon) a syntax check is performed automatically. If the DMScript fails, then the line in error is highlighted and the dialog stays open.

DMScript in Repository

If the "kind" is "DMScript in Repository" then you will be asked to specify the repository in which the DMScript file is located and the name of the file containing the DMScript.

NOTE: You can only specify the name of the file containing the DMScript, so the repository definition must include all the other details required to locate the file in the repository. It may therefore be necessary to define a new repository specifically for DMScript.