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
Etienne Gaudry 5Etienne Gaudry 5 

Wrapper Access

Hi all,

I have a wrapper like this :
public class EU_API_DT_Wrap {
    ...
    public List<Competitions> Competitions;

    public class Competitions {
        ...
        public List<Sessions> Sessions;
    }
    
    public class Sessions {
		public String DateSession;	
		...	
	}
}

How can I access my sessions in my apex methods?
I tried :
EU_API_DT_Wrap myWrap = getSessionsList(saisonId, sportId);

for (EU_API_DT_Wrap.Competitions.Sessions ss : myWrap.Competitions.Sessions){
...}

But it doesn't work.
I only manage to access the competitions like this :
 
EU_API_DT_Wrap myWrap = getSessionsList(saisonId, sportId);

        for (EU_API_DT_Wrap.Competitions comp : myWrap.Competitions){
...}

Thanks for your help :)
ShirishaShirisha (Salesforce Developers) 
Hi Etienne,

Greetings!

Please go through the below document for the sample code which might be helpful:

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_class_cache_Session.htm

Kindly mark it as best answer if it helps so that it can help others in the future.

Warm Regards,
Shirisha Pathuri