+ 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')){
	 
 }