BusComp_PreSetFieldValue Event
Siebel CRM calls the BusComp_PreSetFieldValue event in the following situations:
After the user modifies a field value in the Siebel client and then attempts to leave the field
A call to the SetFieldValue method occurs, but before it performs any field-level validation
This event allows you to use custom validation before Siebel CRM applies predefined validation. This method returns ContinueOperation or CancelOperation. For more information, see Caution About Using the Cancel Operation Event Handler.
Format
BusComp_PreSetFieldValue(FieldName, FieldValue)
The arguments you can use with this format are the same as the arguments described in Applet_ChangeFieldValue Event.
Usage
If your script returns CancelOperation for a field, then Siebel CRM does not enter data for this field. However, Siebel CRM still starts BusComp_PreSetFieldValue for the other fields that the picklist uses to enter data. For more information, see Caution About Using the Cancel Operation Event Handler.
If a user uses a picklist to enter data for multiple fields, then it starts the BusComp_PreSetFieldValue method for each field that the user uses to enter data. For example, in an applet that the user accesses to enter data for the Last Name, First Name, and Contact ID. In this example, Siebel CRM starts the BusComp_PreSetFieldValue method three times, one time for each field.
Siebel CRM does not call the BusComp_PreSetFieldValue event on a picklist or multivalue field.
Usage With Roundtrips
Siebel CRM does the following during a roundtrip to the Siebel Server:
In Browser Script, if the Immediate Post Changes property of the business component field is set to TRUE, then it calls the BusComp_PreSetFieldValue method after the round trip to the Siebel Server completes.
In Server Script, it calls the BusComp_PreSetFieldValue method as the first event in the Siebel Server round trip.
To prevent infinite recursions, if the BusComp_PreSetFieldValue event is running, then Siebel CRM does not run it again for the same business component instance, even if Siebel CRM uses it on a different field in the business component.
Used With
Browser Script, Server Script
Examples
The following Siebel VB example uses the PreSetFieldValue event to determine if a quote discount is greater than 20 percent, and to take the appropriate action if it is. For other examples of BusComp_PreSetFieldValue, see LoginId Method for an Application, and ExecuteQuery Method for a Business Component:
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 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 Function
The following is the equivalent example in Siebel eScript:
function BusComp_PreSetFieldValue (FieldName, FieldValue)
{
var msgtext = "Discounts greater than 20% must be approved";
if (FieldName == "Discount")
{
if (FieldValue > 20)
{
TheApplication().RaiseErrorText(msgtext);
}
else
{
return (ContinueOperation);
}
}
else
{
return (ContinueOperation);
}
}