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
Abdulla d 5Abdulla d 5 

How can i check the field is having a value or not in fieldset based on that i need to write a error message?

Hi all, i have requirement that , fieldset having three fields, while entering data into fieldset fields we need to check that field is null or not?
if it is null it must display some custom message?but not using validation rule how can i achieve it? how to get fieldset fields in apex to check th filed is not null?
Raj VakatiRaj Vakati
Try this code
 
List<FieldSetMember> fieldsToCheck = Schema.SObjectType.Object.fieldSets.Fields_To_Check.getFields();
Map<String,String> mapss = new Map<String,String>();
   for( Schema.FieldSetMember fsm : fieldsToCheck ) {            
	 
	   mapss.add(fsm.getLabel() ,fsm.getLabel());  
	 
 }  
 
 
 
 If(mapss.contains('Fields')){
	 
 }