Bookshelf Home | Contents | Index | Search | PDF |
Siebel Object Interfaces Reference > Interfaces Reference > Business Component Events >
BusComp_PreSetFieldValue
The PreSetFieldValue event is called before a value is pushed down into the business component from the user interface or through a call to SetFieldValue.
Syntax
BusComp_PreSetFieldValue(FieldName, FieldValue)
Argument Description FieldName String containing the name of the changed field FieldValue String containing the changed valueReturns
ContinueOperation or CancelOperation
Usage
The PreSetFieldValue event is called each time a field is to be changed or populated for a given business component.
When using a picklist to populate multiple fields, PreSetFieldValue is fired for each field that is populated. For example, the Contact Pick Applet is used to populate Last Name, First Name and Contact ID. Therefore, PreSetFieldValue is fired three times, once for each field.
CancelOperation stops the execution of the underlying Siebel code associated with the event. However, if there is code in the same script following CancelOperation, that code runs regardless of the CancelOperation. In the preceding example, if your script returns CancelOperation for a field, that field is not populated. However, PreSetVieldValue still fires for the other two fields populated by the picklist.
NOTE: The PreSetFieldValue event has code that prevents it from running if it is already running on the same BusComp instance (even for other fields). This is to prevent the writing of scripts that might cause infinite recursions.
NOTE: The PreSetFieldValue event in Browser Script is not invoked if the field's Immediate Post Change property is set to TRUE.
Used With
Browser Script, Server Script
Example
This Siebel VB example uses the PreSetFieldValue event to check if a quote discount is greater than 20 percent, and to take appropriate action if it is. For other examples of BusComp_PreSetFieldValue, read LoginId, and ExecuteQuery.
Function BusComp_PreSetFieldValue (FieldName As String,
FieldValue As String) As Integer
`Routine to check if a quote discount>20%
`if it is, notify user and cancel 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"
RaiseError msgtext
BusComp_PreSetFieldValue = CancelOperation
Else
BusComp_PreSetFieldValue = ContinueOperation
End if
End If
End FunctionHere is the equivalent example in Siebel eScript.
function BusComp_PreSetFieldValue (FieldName, FieldValue)
{
var msgtext = "Discounts greater than 20% must be approved";var iReturn = ContinueOperation
if (FieldName = "Discount")
{
if (FieldValue > 20)
{
TheApplication().RaiseErrorText(msgtext);
return (CancelOperation);
} else
return (ContinueOperation)
}
}
else
return (ContinueOperation);
Bookshelf Home | Contents | Index | Search | PDF |
Siebel Object Interfaces Reference Published: 18 June 2003 |