+ Start a Discussion
r_boyd_848r_boyd_848 

Creating Visualforce pages dynamically

I'm developing a wizard that lets user choose the steps they want to use based on pre-existing visualforce pages. And its coming along nicely. However it did raise a question in testing - which led to a thought :manhappy:.

 

Good testing practice indicates that you should not assume that data, such as a particular account, exists and that you should create test data in the Test Buildup. In this case I'm using an SObject to store the URL's of certain VisualForce pages, yes I know I could populate the SObject in the Test Code with known VF pages (which is what I'll probably have to do).

 

BUT, and this is out of technical curiousity, is there a way to dynamically (i.e. use APEX) to create a visualforce page?

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

I'm afraid not - pages can be created via the metadata api, but that's not available via apex.

All Answers

bob_buzzardbob_buzzard

I'm afraid not - pages can be created via the metadata api, but that's not available via apex.

This was selected as the best answer
r_boyd_848r_boyd_848

Thanks. The Meta Data approach is for a different scenario, useful to know though