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
mpoiriermpoirier 

Page .getParameters()

 

 

This does not work: 

 

        Map<String,String> req = ApexPages.currentPage().getParameters();

 

        System.debug.(Logginglevel.INFO, req.size.format);
       
        for (String s:req)
        {
            System.debug(s);
        }

 

I get this error message:

 

Error: Compile Error: Initial term of field expression must be a concrete SObject: MAP:String,String at line x column x 

 

What does that mean ?

 

"currentPage().getParameters()" is supposed to return a "Map<String,String>"...

 

 

Also, is there a way to format the debug output a little bit so it is more readable ? It displays in one big string in the Console right now...

 

Thanks ! 

 

lvivaninlvivanin

currentPage().getParameters()" is supposed to return a "Map<String,String> but not the LIST:MAP:String,String.

 

for (variable : list_or_set) {
code_block
}

 

lvivian

mpoiriermpoirier

Not sure I understand what you're saying but this works:

 

        Map<String,String> req = ApexPages.currentPage().getParameters();

 

        Set<String> cbKeys = new Set<String>();
        cbKeys = req.keySet();
       
        List<String> cbValues = new List<String>();
        cbValues = req.values();

 

        for (String k:cbKeys)
        {
            System.debug(k);
        }

 

        for (String v:cbValues)
        {
            System.debug(v);
        }

 

Thanks !

Richie DRichie D

This may be a little better:-

 

 

Map<String,String> req = ApexPages.currentPage().getParameters(); for(string key :req.keySet()){ System.debug(key+': '+req.get(key); }

  

 

 

mpoiriermpoirier

Thanks !

 

Right now I am just trying to keep my head above water, translating everything mentally to C#...

 

Every bit counts !