Hi Siebel lackies. This is a great little trick I discovered recently. In my fight for zero-footprint customizations of Siebel, this is one weapon that is foundational part of my arsenal going forward.
Using a combination of Run Time Events and Application Business Services (in other words not developed in tools and compiled in the SRF), you too can validate a field and message the user. Done properly, you can validate every field in your business component - no joke.
Let's get to it. Here's the scenario: I don't want users closing a Service Requests with a Resolution of "Other" without an entry in the "Comment" field. It's a common request. First create your business service. You should create a method and then handle that method in the pre_invoke. If you don't know how to do that, you are in bad shape. Here's the function we'll be using that is relevant to this method:
function SRClosedError ()
{
TheApplication().ActiveBusObject().GetBusComp("Service Request").UndoRecord();
TheApplication().RaiseErrorText("The Service Request cannot be closed with a Resolution Code of other without a Comment.");
}
Notice what I am doing here: I am just rolling back the junk from the user and popping a message box. In 7.7.2 and up, RaiseErrorText gives you a message box.
Now go to Site Map -> Administration - Run Time Events -> Action Sets. We need to create the Action Set for our Event. Create a new Action Set record and name it Customer_Prefix Service Request BusComp Validations. Note that "Customer_Prefix" is the same prefix you've been using in your repository. Since this is a master entity record it receives the prefix.
Now create a child Action. Let's call it Comments Required when Resolution = Other. Do not set a value for Conditional Expression. Set the Action Type to Business Service and then set the Business Service Name and Method fields. Also set sequence.
Next create the Event. Click on the Events View. Create a new record. Object Type = BusComp, Object = Service Request. Then pick that Action Set you created. Now drill to the Action Set. Since you've drilled into the Action Set from the Event, the Conditional Expression java applet will get the business component needed to be in context. Add your conditon for the Action (not the Event and certainly not the Action Set). The Conditional Expression on the Action called "Comments Required when Resolution = Other" should be [Resolution Code]=LookupValue("SR_RESOLUTION","Other") AND [Description] IS NOT NULL.
That's it. Reload Run Time Event using the command on the applet menu. Enjoy.