Siebel Object Interfaces Reference > Interfaces Reference > Application Methods >

RaiseError Method


The RaiseError method raises a scripting error message to the browser. The error code is a canonical number. The error text is based on the specified key, looked up for the current language from the User-Defined Errors category. You can define these errors in Tools using the Message Category object. The optional arguments are used to format the string if it contains any substitution arguments (%1, %2).

Syntax

Application.RaiseError(key, [arg1], [arg2],...., [argN])

Argument
Description

key

Name of the Message object, as defined in Siebel Tools, whose text contains the value to be used.

arg1, arg2, ..., argN

Optional arguments used to format the error message if it contains any substitution arguments (%1, %2).

Returns

Not applicable

Usage

When invoked, the RaiseError method causes execution of the script to terminate, and sends a notification to the browser. Therefore, CancelOperation is not required after RaiseError.

Internally, the RaiseError/RaiseErrorText methods raise a Server Script exception. If you have implemented error handling in your scripts, the error handling can suppress RaiseError and RaiseErrorText functionality.

If you have implemented error handling in Siebel VB, when using "On Error Goto ...", the RaiseError and RaiseErrorText methods result in the script transferring execution to the error handler. "On Error Resume Next" suppresses the RaiseError and RaiseErrorText methods.

CAUTION:  Be careful when using RaiseError, because it cancels operations. For example, if it is used in BusComp_PreWriteRecord, the user or code will not be able to step off the current record until the condition causing the RaiseError method to be invoked is addressed.

Used With

Server Script

Example

In the following eScript example, the RaiseError results in a scripting exception being raised, transferring control to the catch statement. To display the error message, the error must be thrown using the throw statement.

function BusComp_PreDeleteRecord ()
{
   try {
      var status = this.GetFieldValue("Account Status");
   
      if (status == "Gold") {
         TheApplication().RaiseError(<user defined error name>);
      }
      else {
         return (ContinueOperation);
      }
   }
   catch (e) {
      throw e;
   }

}

The following eScript example raises the error message "This user-defined test error is used in PreDelete, as an example for RaiseError Method" when deleting an opportunity with the "Pipeline" revenue class. Note that the key "user-defined test error1" is predefined as "This user-defined test error is used in %1, as an example for %2". When the script runs, 'PreDelete' is substituted for %1 and 'Raise Error Method' is substituted for %2.

function BusComp_PreDeleteRecord ()
{
   try
   {
      var revClass = this.GetFieldValue("Primary Revenue Class");
      if (revClass == "1-Pipeline")
      {
         TheApplication().RaiseError("user-defined test error1", "PreDelete",
         "RaiseError Method" );
      }

      else
      {
      return (ContinueOperation);
      }

   }
   catch (e)
   {
      throw e;
   }

}

Siebel Object Interfaces Reference Copyright © 2008, Oracle. All rights reserved.