Saturday, July 23, 2011

RaiseError Method

To Start, RaiseError Method is one of the Application Methods.
The RaiseError method raises a scripting error message to the browser.
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.

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.

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;
 }
}

No comments:

Post a Comment

Followers

Search This Blog