Siebel Object Interfaces Reference > Customizing Siebel Object Interfaces > Customizing Object Interface Events and Extension Events >

Customizing How Siebel CRM Continues an Operation


This topic describes how to customize the way Siebel CRM continues an operation.

To customize how Siebel CRM continues an operation

  • To process data before the default event method runs, set the return value for this predefined event to ContinueOperation.

    The return value for a preoperation event is ContinueOperation. It configures the calling Siebel object to continue processing the remaining operations that Siebel CRM associates with the event.

    If you handle a custom method in a preevent, then that event must return CancelOperation or you must handle the custom method somewhere in the process. For important caution information, see Caution About Using the Cancel Operation Event Handler.

Caution About Using the Cancel Operation Event Handler

Including the CancelOperation return value configures the Siebel application to cancel the remaining operations that Siebel CRM associates with the event.

CAUTION:  If you define a custom object interface method, then you must include the CancelOperation return value. If you do not, then Siebel CRM issues an unknown method name error.

CancelOperation does not stop the code in a script that follows CancelOperation, but it does prevent Siebel CRM from running any predefined code that is associated with the method or event that is running. If you handle the method or event entirely through scripting, and if you must prevent the predefined code from executing, then the method or event must return CancelOperation.

For more information, see How Siebel CRM Handles a Predefined Business Service Method.

Example of Using Siebel VB to Create a Validation

The following Siebel VB example creates a validation that queries a specific field to determine if the object interface event completed successfully or completed with a run-time error:

Function BusComp_PreSetFieldValue (FieldName As String,
               FieldValue As String) As Integer
' code to check if a quote discount > 20%
'       if it is, notify user and cancel the operation
Dim value as Integer
Dim msgtext as String
   If FieldName = "Discount" then
      value = Val(FieldValue)
      If value > 20 then
          msgtext = "Discounts greater than 20% must be approved"
         TheApplication.RaiseErrorText msgtext ' cancels the run
      Else
         BusComp_PreSetFieldValue = ContinueOperation
       End if
End If
End Function

Note the If statement in the following pseudocode:

If condition is true
   call custom code
   raise error text to cancel operation
Else
   returnValue = ContinueOperation
End If

In this If statement, Siebel CRM runs the custom code only if the condition is true:

  • If the condition is true, then Siebel CRM uses the custom code instead of the predefined code.
  • If the condition is not true, then the event handler returns ContinueOperation, and Siebel CRM uses the predefined code.

You can also use the following alternative If statement:

returnValue = ContinueOperation
If condition is true
   call custom code
End If

Note that with a PreInvokeMethod event, you use the method name to determine if the script conditionally runs. For example, consider the following code in Siebel eScript:

if (methodName == "PushOpportunity")

Example of Using Siebel eScript to Create a Validation

The following Siebel eScript example creates a validation that queries a specific field to determine if the object interface event completed successfully or completed with a run-time error:

function BusComp_PreSetFieldValue (FieldName, FieldValue)
{
   var iReturn = ContinueOperation;
   //code to check if a quote discount > 20%
   //if it is, notify user and cancel the operation
   var varvalue;
   var msgtext;
   if (FieldName == "Discount")
   {
      varvalue = ToNumber(FieldValue);
      if (varvalue > 20)
      {
         msgtext = "Discounts greater than 20% must be approved";
         TheApplication().RaiseErrorText(msgtext); // cancels the run
      }
      else
      {
         iReturn = ContinueOperation;
      }
   }
}

Siebel Object Interfaces Reference Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Legal Notices.