You need to sign in to do that
Don't have an account?
tobibeer
How to verify whether a VisualForce page exists?
How can I programatically verify whether or not a page by the name of "xyz" exists?
Neither the ApexPages namespace nor the PageReference object seem to provide any such method.
Reading is not my strong suit.
[select Id, Name from ApexPage where name = 'MyPage']
Works for me.
Keep im mind im running this query via SOQL Explorer. I wouldnt be suprised if you couldnt instantiate an ApexPage or class within your code. Try a count() query.
All Answers
[select Id from ApexClass WHERE Name = 'MyClass']
Doesn't seem to work. With...
...I always get...
...whether a page of that name exists or not.
Reading is not my strong suit.
[select Id, Name from ApexPage where name = 'MyPage']
Works for me.
Keep im mind im running this query via SOQL Explorer. I wouldnt be suprised if you couldnt instantiate an ApexPage or class within your code. Try a count() query.
Thanks, that did it. Now I can simply wrap the lot in a try catch statement to handle non-existing pages. Great!