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
adreameradreamer 

Page.existingPage does not compile

Hi All,

 

In one of the test methods for a controller extension I am setting the page to the controller using:

 

Test.setCurrentPage(Page.existingOne);

 

Yesterday compiled all day. Today after the first compile I get a compile error: variable does not exist: Page.existingOne .

 

In addition, the line:

 

PageReference p = Page.existingOne;

 

does not compile either and gives the same compilation error.

 

The page existingOne.page exists in the org, and none of the pages has the word "page" in their name.

 

Any ideas ?

 

Thanks,

Fernando

Best Answer chosen by Admin (Salesforce Developers) 
aballardaballard

Have you added a class or variable called "Page"?

All Answers

Shashikant SharmaShashikant Sharma

I thing this page does not exist in your org that is the only reason that comes to my ming. I would like you to check in your org through browser where it exists or not. Some time when you delete a page it still comes in eclips till you refresh your code. Please check one more time through your broser. In case it exists then please provide me your class version number. I will try my self then.

aballardaballard

Have you added a class or variable called "Page"?

This was selected as the best answer
adreameradreamer

Hi Aballard,

 

You are spot on !. I don't have any page that its name includes the string "page" but I did have a variable named "page" and that was the cause of the issue.

 

It seems that the Visualforce compiler gets confused if one uses such a variable name.

 

Thank you very much !

 

Fernando

adreameradreamer

Hi ,

 

Thanks for your reply.

 

The issue as you can see from the thrad is that I had a PageReference variable called "page".

 

Regards,

Fernando