0

I use VS Code with Salesforce Extension Pack.

I have this line in my class code:

string cId = ApexPages.currentPage().getParameters().get('cId');

It gets a squiggle line under getParameters() and a message "Method does not exist or incorrect signature: void getParameters() from the type System.Pagereference"

Apex reference clearly says here: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_System_PageReference_methods.htm

getParameters(): Returns a map of the query string parameters for the PageReference; both POST and GET parameters are included. The key string contains the name of the parameter, while the value string contains the value of the parameter.

In another language I would think I'm missing a library reference or something but there is no such thing in VS Code with Salesforce Extension Pack! (or is there?)

Why is the error and how can I fix it?

Thank you Very Much!

1
  • FWIW, Illuminated Cloud IC2 IDE does not exhibit this behavior
    – cropredy
    Jan 9 at 1:57
0

It gets a squiggle line under getParameters() and a message "Method does not exist or incorrect signature: void getParameters() from the type System.Pagereference"

This looks like a bug. This method definitely exists and has not been removed recently.

In another language I would think I'm missing a library reference or something but there is no such thing in VS Code with Salesforce Extension Pack! (or is there?)

Yes, there's the Apex Language Server. It provides autocompletion and error hints to VS Code. Make sure that it's running (it should be noted in the Output tab of the bottom panel). Also make sure the extension is not disabled and is the latest version.

Why is the error and how can I fix it?

Make sure everything's up-to-date, and also try restarting your computer. If this error persists, you may want to reach out to the DX team to see what can be done about fixing it. I'm not currently getting the error, so it's not apparently affecting everyone. Also, this shouldn't prevent deployments, so you might also just choose to ignore it.

1
  • yeah everything is up to date. Actually I had to install and reinstall everything like 10 times. Apex Language Server didn't recognize Java version neither 8 nor 11 didn't work. eventually AdoptOpenJDK\jdk-11.0.9.101-hotspot\ worked. (and yes I did set Salesforcedx-vscode-apex › Java: Home). ##You say: there's the Apex Language Server## That's true but we don't explicitly specify which library to link in. They promised to do it automatically but seems to have failed this time :(
    – shlasasha
    Jan 9 at 0:31

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.