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
KbhaskarKbhaskar 

dynamic for loop

hi,
I do have a requirement where we need to use for loop  with if statement for multiple fields if selected ,is it possible ?
}	
public pagereference actionsupport()                 //pageReference method
	{
		lstwrapperIntString = new List<wrapper>();       //new lstwrapperIntString list
		Map<String, SobjectField> fieldMap = Opportunity.getsObjectType().getDescribe().Fields.getMap(); 
		for(String f : fieldMap.keySet())
		{
			lstwrapperIntString.add(new wrapper(fieldMap.get(f).getDescribe().getLabel(),selectedValue));
		}
		return null;
	}
	public class wrapper    //Wrapper Class 
	{
		public boolean selectedread  {get;set;}
		public boolean selectedwrite {get;set;}

		public String  fieldName     {get;set;}

		public wrapper(String Name,String write) // wrapper constructor 
		{
			this.fieldName=Name;                     
			this.selectedread=true;
			if(write=='writeseleted')
			{
				this.selectedwrite=true;
			}
		}  
	}

 
Best Answer chosen by Kbhaskar
Tejpal KumawatTejpal Kumawat
Hello Bhaskar,

Can you elaborate your query/use case?

Regards
Tej palKumawat