Scripting is very powerful tool in Siebel. You can do all sorts of things using script which you cannot achieve through configuration. If use properly it can enhance Siebel Application to any extent but if not used properly it can seriously hamper application life and cause issues like performance degradation, data integrity and other runtime errors.
Siebel has provided us various events in which we can write script. Every event has its own significance and offers us something that others don’t. So, it is very important to choose the right event to write our script otherwise it can lead to problems.
In this series I will discuss various events available at BC level in Siebel and answer questions like when and why you should be using particular event with the help of various requirements.
So the first in the list is
BusComp_PreSetFieldValue: As it is clear by its name it fires before a value of the field is set. The signature of this event is
function BusComp_PreSetFieldValue (FieldName, FieldValue)
Where FieldName is the name of the field which is being set and FieldValue is the value that is being set.
Imp: This is the only event where we have access to Old and current value of the Field that is being set. So, it is usually used for requirement where you want to check old value before doing something with the new value.
Note: You can access old value of the field using “this” keyword for example
If user has changed the value of Status field from “Completed” to “Closed”
this.GetFieldValue(“Status”) will give the value “Completed” and FieldValue will have “Closed”
Let’s try to understand with example.
Requirement:
I want to popup a message to user saying “Please Fill the Comments Field” if user sets the value of SR from “Completed” to “Closed”
Precaution: Don’t write validation scritps here as user has a choice to undo the record and your validation will fail
Then the best place to write the code is BusComp_PreSetFieldValue. I am not writting the script here. Let me know if you want me the write the exact script also.

1 Comment at "Exploring Siebel BC scripting events - BusComp_PreSetFieldValue"
In this requirement i would prefer to write the validation on BusComp_PreSetFieldValue only because if the comment field is not populated i can avoid the status to get changed to “Closed”.
We can write this validtion in the BusComp_WriteRecord also but we can catch the validation failure before getting to this event only.
Comment Now!