Tuesday, February 22

Making a field required using script at the applet level

Making a field required using script at the applet level 


Requirement : Making 'Contact Method' field required in an applet which is not 'required' field in the buscomp

Solution: I used the below script at applet level to make the 'Contact Method' required.The code is pretty simple as shown here.

if ( MethodName == "WriteRecord" )
    {  
    if(this.BusComp().GetFieldValue("Contact Method") == "")
    {
    TheApplication().RaiseErrorText("Contact Method is a required field please enter a value");
     return( CancelOperation );
    }

Readers,please let me know the other possibilities of making field required at applet level with out using script

4 comments:

Narendra Meka said...

There is a possibility using 'Show Required' applet user property.

Syntax:

Name: Show Required 1

Value: Applet control name.

I am not sure whether this will support all the classes.

Anonymous said...

“Required”, a field user property which calculates an expression to decide whether the field should be mandatory or not.
This is very useful for making field mandatory, conditionally.

Required Field User Property

Create Field User Prop for “Spouse Name” field :
Name : Required
Value : IIf ([Married] = “Y”, “Y”, “N”)

Narendra Meka said...

The "Required" field user property is to make a field required conditionally.

Here the requirement is to make field read only at applet level,as there are many applets on the BC and I need the field required in only one applet and in other applets the field should not be "Required"

to achieve this you can use above script and also you can try using an applet user property called "Show Required"

Anonymous said...

If you always want the field to be required, then you would just make it required at the Business Component Field level.

Blogger Widgets