I am getting an error

Error is in expression '{!setGroupBy}' in page customjobapppage:

I tried multiple approach and I ended up with this: so this is how i Initialize my map

public Map<string,List<Job_Application__C>> groupedByPositionList{get;  set;}

and used trying to populate it like this:

public void setGroupBy(){
        for(Position__c p : [select Id , job_title__c from Position__C]){
             groupedByPositionList.put(p.Job_Title__c,new List<Job_Application__c>());
    system.debug('TESTER' + groupedByPositionList);

I am trying to insert an empty List of SObject but it is throwing me an error above , any thoughts about this?

I am a newbie currently on its 2nd day trying to code in salesforce , Maybe this is a newbie question . Any help would be greatly appreciated. Thank you so much.


Found the answer , foolish of me my apologies.

I missed this Code

groupedByPositionList = new Map<string,List<job_application__c>>();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.