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;
}
}
}