Monday 24 February 2014

How to make a field required in Siebel?

If you have any better way of making a field required please share it ,as information shared is information gained. I know possible two ways of implementing it.


1. Making Field required at BC Level

Required field ticked makes it a required field











2. Making field required using scripting
        You can use  server scripting at Applet level or Business Component level to meet the functionality

 if(this.GetFieldValue("Type") == "")
    {
    TheApplication().RaiseErrorText("Attachment type is a required field");
    return(CancelOperation);
    }
        In this case I choose to write the script at business component level and I used the script at prewrite record event. Depending upon your requirement the event chosen can be changed.Basically what done here is you try to get the value of the field using this.GetFieldValue("Type") and if the value returned is null then and error is thrown. Now you may ask why I have not chosen the first method to meet the requirement. If I go to follow the first method then the field will be required at all places where the BC is used since this BC may be used by many applets. Using the second method I can constrain the field to be required in one or multiple views using another if statement.

if(TheApplication().ActiveViewName() == "Members Attachment Detail View" )
    {
    // Added to make Attacment type as required//
    if(this.GetFieldValue("Type") == "")
    {
    TheApplication().RaiseErrorText("Attachment type is a required field");
    return(CancelOperation);
    }
   
    }
In this case the field will be required only in the particular view mentioned.

Hope this helps! Have a great day:-)

No comments:

Post a Comment