How to make a field required in Siebel?
Siebel provides a lot of flexibility for the developer in configuring a solution. Right skills provide absolute power to ensure that the design is usable, performs well, and a scalable to future changes.
But it can become a problem if developers blindly follow the past. What “always worked in the past” may not be the right thing after all.
Consider an example to make a field conditionally required. There are multiple ways of accomplishing this task, and the typical ways to make a required field are -
1. Required field user property
Create a user property under the Field object to make it conditionally required. The field in question becomes required when the value provided in ‘User Property’ attribute evaluates to TRUE.
Consider an example: you want to make “Start Date” of an address mandatory if the address type ease “Temporary”.
In “Cut Address” BC, create the following user property against the “Start Date” field.
Name: Required Value: IIF ( [Type] = LookupValue ("ADDR_TYPE", "Temporary")) , 'Y', 'N')
Configuring the user property is easy enough and is the recommended way to configure a conditionally required field.
Scripting is typically depicted as evil in the recent times - entire books have been written to recommend configuration over scripting.
It may be just me, but I have seen complex validations that execute faster and are easier to maintain when scripted. I would take the scripted solution any day rather than write an elaborate chain of calculated fields that no one seems to understand.
The ‘script’ is quite straightforward in a PreWriteRecord event to mandate a field.
if (this.GetFieldValue("Type") == LookupValue ("ADDR_TYPE", "Temporary")) TheApplication().RaiseErrorText("Spouse Name is a mandatory field");
You could also do this in any of the other events, or enable any combination of updates when a dependent field is already populated.
3. Using field validation
“Validation” is a ‘Field’ attribute that provides an easy way to check the value in a dependent field.
Here’s an example -
LookupValue ("ADDR_TYPE", "Temporary") AND [Start Date] <> "")
You can use a custom message to tailor the UI experience for the user in this method.
There are numerous ways to accomplish a task in Siebel and the three ways depicted here just touch the surface. The point here is simple - apply your design skills and judgement to choose the best method for a situation.