Opening a URL

The GSU_CQXE_OpenURL global hook opens a web browser window to a specified URL. The function first opens a confirmation dialog, whose message you can customize. If the user clicks OK in the dialog, the browser opens; if the user clicks Cancel, the dialog closes and focus returns to the record form.

For instructions to download the global hook code, see technical note 1432968 at http://www.ibm.com/support/docview.wss?&rs=939&uid=swg21432968.

This functionality is available on the ClearQuest clients for Eclipse and the web. If a user attempts to open a URL from an older client, or from the ClearQuest client for Windows, the API returns an informational message. To display this message to the user, call the die function.

Examples

The following examples show a record script that you can use with the global hooks to open a URL. In these examples, clicking an OpenIBM button opens a dialog and asks whether the user wants to open a browser to the specified URL. If the user clicks OK, a browser window opens to www.ibm.com; if the user clicks Cancel, the dialog closes.

To use this example, make the following changes to your schema:
  1. Create a record script named Open_Url, using the Perl or VBScript example.
  2. Add a new tab named OpenURL to the Defect_Base form in the Defect record type.
  3. On the OpenURL tab, add a new Button control named OpenIBM, and associate it with the Open_Url record script.

Perl examples

sub Defect_OpenURL {
    my($result);
    my($param) = @_;
    # record type name is Defect

    $url="http://www.ibm.com";
    $msg="Do you want to open a browser to this URL?";
    my $session = $entity->GetSession(); 
    GSU_CQXE_OpenURL($session, $url, $msg);
    
    return $result;
}

VBScript examples

Function Defect_OpenURL(param)
  ' param As Variant
  ' record type name is Defect
    Dim url
    Dim message
    set session = GetSession
    url = "http://www.ibm.com"
    message = "Do you want to open a browser to this URL?"
    Defect_OpenURL=GSU_CQXE_OpenURL(session, url,message)
End Function

Feedback