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
VirajViraj 

Programaticaly call the Visualforce page create screen using Apex

Hi,

 

I want to programaticaly (using Apex) call the Visualforce page create screen.

 

Can I use the following ?

 

PageReference pageRef = new PageReference('/066/e?retURL=%2Fapexpages%2Fsetup%2FlistApexPage.apexp');

 

Will there be guarantee this will not change for other salesforce organizations?

 

Is there any other way for doing it ?

 

 

Thank you

Viraj

jeffdonthemic2jeffdonthemic2

Viraj,

 

Take a look at the StandardController class documentation but your code should work across orgs.

 

You can have a controller return a page reference to the standard edit (new) page with something like this. It's just a snippet and not the entire controller.

 

private Opportunity opp;public PageReference new() { return (new ApexPages.StandardController(opp)).edit();}

 

 

 

 

 

Jeff Douglas

http://blog.jeffdouglas.com

Appirio 

VirajViraj

Thank you Jeff Douglas for the answer.

 

But what I wanted is not that. I want to edit or add an Apexpage object.

 

This  Apexpage object contains Visualforce page source code.

 

Viraj