The ClearQuest clients for the Web and Eclipse allow hooks to present error, warning, and information alert messages to users by embedding the alert message parameters within a normal hook error message. However, because the ClearQuest for Windows client, user-written scripts, and older clients might not recognize the alert message parameters, this capability should be accessed through the global hook below, after adding it to your schema. The hook uses the message parameters in a normal die statement if the client does not support custom messages, but dies with a custom message if the client supports it.
The DieWithCustomMessage function below can be called from all places where a die statement can be used, and it will have the same effect as a die statement on the current operation. For example, calling the DieWithCustomMessage function from an access control hook would indicate failure in exactly the same way a die statement would indicate failure, but with a custom message.
For instructions to download the global hook code, see technical note 1322606 at http://www.ibm.com/support/docview.wss?&rs=939&uid=swg21322606.
sub Defect_generate_error_message { my($result); my($param) = @_; # le nom du type d'enregistrement est Défaut $error_summary="ReturnCustomErrorMessage"; $error_details="Error message: Clicking this button will activate a computer virus!"; # $result=&DieWithCustomMessage($error_summary,$error_details,"ERROR"); DieWithCustomMessage("ERROR",$error_summary, $error_details); return $result; }
sub Defect_generate_warning_message { my($result); my($param) = @_; # le nom du type d'enregistrement est Défaut $error_summary="ReturnCustomWarningMessage"; $error_details="Warning message: Do not smoke at the work place!"; DieWithCustomMessage("WARNING",$error_summary, $error_details); return $result; }
sub Defect_generate_info_message { my($result); my($param) = @_; # le nom du type d'enregistrement est Défaut $error_summary="ReturnCustomInfoMessage"; $error_details="Information message: Welcome to Beijing!"; DieWithCustomMessage("INFO",$error_summary, $error_details); return $result; }
Function recordtype_ErrorMessage(param) ' param As Variant ' record type name is recordtype REM add your hook code here Dim error_summary Dim error_details error_summary="ReturnCustomErrorMessage" error_details="Error message: Clicking this button will activate a computer virus!" ' $result=&DieWithCustomMessage($error_summary, $error_details,"ERROR"); call DieWithCustomMessage("ERROR",error_summary, error_details) End Function
Function recordtype_WarningMessage(param) ' param As Variant ' record type name is recordtype REM add your hook code here Dim error_summary Dim error_details error_summary="ReturnCustomWarningMessage" error_details="Warning message: Do not smoke at the work place!" call DieWithCustomMessage("WARNING",error_summary, error_details) End Function
Function recordtype_InfoMessage(param) ' param As Variant ' record type name is recordtype REM add your hook code here Dim error_summary Dim error_details error_summary="ReturnCustomInfoMessage" error_details="Information message: Welcome to Beijing!" call DieWithCustomMessage("INFO",error_summary, error_details) End Function