Creating a Workflow Script

You use the Script Editor to add VBScript code to an ALM event procedure, or to create user-defined procedures that can be called from an ALM event procedure.

To create a workflow script:

  1. In the Workflow window, click the Script Editor link. The Script Editor opens.

    For details on the Script Editor window, see The Script Editor.

  2. In the Scripts Tree, select the node of the module for which you need to customize the workflow.

    The Scripts Tree contains the Common script node in addition to the nodes for specific modules. When you create user-defined procedures that must be accessible from several modules, place them under the Common script node. To declare a global variable that can be used across all modules, declare the variable under the Common script node, outside of any function.

  3. Expand the node and select the event procedure to which you need to add code, depending on when you want your code to be triggered. The existing script for this event procedure is displayed in the Scripts pane.

    For a description of ALM event procedures, see Workflow Event Reference.

  4. Add your VBScript code to the script.

    Note: A red indicator next to a module name in the Scripts Tree indicates that there are unsaved script changes in that module.

  5. To use the code complete feature instead of typing in the names of ALM objects, properties, methods, and fields, place the insertion point at the location where you want to insert an object name and click the Code Complete button. For information about ALM objects, see Workflow Object and Property Reference.

  6. To use the code template feature instead of typing in commonly used VBScript statements, place the insertion point where you want to insert the code and click the Code Template button. Choose one of the following items from the code template list:

    Template

    Code Added to Script

    FVal: Fields value access

    Fields.Field("").Value

    List: QualityCenter list access

    Lists.List()

    IfAct: Action "switch" If Block

    If ActionName = "" Then

    End IF

    Act: Actions access

    Actions.Action("")

    Func: Function template

    Function
       On Error Resume Next

       On Error GoTo 0
    End Function

    Sub: Sub Template

    Sub
       On Error Resume Next

       On Error GoTo 0
    End Sub

    Err: Error Handler

    On Error Resume Next

  7. To insert an item from a field list defined in the project, place the insertion point at the location where you want to add the item. Click the List Value button. In the Lists box of the Select Value From List dialog box, choose the name of the list. In the List Items box, select the list value.

  8. To insert an ALM field name, place the insertion point at the location where you want to add the field name. Click the Field Names button. Select a name from the list of system and user-defined fields in the ALM project.

  9. To validate the syntax of the script, click Syntax Check . Any messages are displayed in the Messages pane.

  10. Click the Save button to save the script.

  11. Close the Script Editor.