throw to debug Siebel eScript

“throw” statement in Siebel eScript is inherited from the ECMA script. It will pass the error details back to the caller if there is an error during the script execution.

The error message reaches the highest level, and then there are no more levels it just gets thrown back to requester.

Consider a business service that calls an internal custom function from its Service_PreInvokeMethod method. If you use “throw” statements both in the pre-invoke method and in the custom function, this is what you will observe..

throw statements to debug Siebel eScript

Service in question is called from from the Business Service Simulator. You will see the same behaviour even if you call the business service from a button, user property, or other scripts.

As you can see from the screenshot, it becomes really easy to locate the source of the problem. In this case it was a typo error - script has GetBusinessObject instead of GetBusObject.

Though “throw” makes it very easy for a developer to debug the scripts, complex error messages are not encouraged to be shown to the end user. You can then use TheApplication().RaiseErrorText in the custom function to simplify the error message.

RaiseErrorText vs throw in Siebel script

Although this is still cryptic, the users are assured to not freak out by looking at the error message.

Tags :
    Comments powered by Disqus

    Related Posts

    Automate simple tasks using Macro in Zoho CRM

    Automate simple tasks using Macro in Zoho CRM

    We have seen what Zoho is before, and also have carried out the right automations in the past.

    Read More

    Apex Recipes by Salesforce

    I am excited about the recent announcement of Apex recipes by Salesforce .

    Read More

    3 Things I Don't Like in Salesforce Lightning

    Salesforce Lightning is great. We have a sophisticated UI for the Salesforce product in Lightning-

    Read More