function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
onlinebooks@sambodhi.comonlinebooks@sambodhi.com 

how many ways we can do mandatary the field ? can any one say plz thanks in advance

How many ways we can do  mandatary the field ? can any one say plz ....thanks in advance 

AroraAnupAroraAnup

There are a few ways to make a field mandatory:

 

1. You can set a field as REQUIRED via the Page Layout

2. You can set a field as REQUIRED using a Validation Rules (field will become mandatory based upon a specific criteria)

3. You can also use the Field Level Security at the profile level to define access to a field

 

Hope this helps!

Marko LamotMarko Lamot

4. via trigger

Michael_TorchedloMichael_Torchedlo

The first suggestions that were posted here are the best ones, but there are other ways, depending on how complicated your scenario is.

 

5.  You can create a workflow rule that does a field update any time the object is saved with the "mandatory" field blank, and set it to be some default value.  (This is not forcing the USER to always enter a value, but it does enforce that the field will never be blank, because the system will automatically fill in what the user missed). 

 

6.  If your page layout is custom built (Visualforce), you can either set the <apex:inputField  required="true">, or you can create an Apex controller for the page with a method that enforces that field being properly populated, and then throws an error or page message to the user when they try to save without it.

Paresh KoshtiParesh Koshti
We can add formula too? for field validation by using isBlank()  or size()