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
Hugh RaineyHugh Rainey 

How do I develop a visualforce page in an active org

I'm a newb when it comes to developing on the SF platform.  I've got experience with web application development, but like I said, I'm new to this.  

So I'm trying to create a VF page that will renderas="pdf".  The information will come from the Account sObject that will have use the information from custom fields.  It'll be really easy to make accept for that I can't make an pages in an active org.

I start the dev console > New > Visual Force page

The console looks like its already to go, but I can't save as an alert box pops up with the following:

Deployment Failed
Can't alter metadata in an active org

Right now the only thing that is typed into the editor is:
<apex:page>
</apex:page>

So how do I go about developing a page?
Bradley DelauneBradley Delaune
Hi Hugh,

Development can't be done in an active Org.  You will have to "cut" a developer sandbox and develop it there.  Then you can create a "Change Set" and add the page and related components to the change set and send it to the production organization.

You will need to have 75% test coverage in order to push Apex code to production.

Create a sandbox: Setup > Data Management > Sandboxes > New Sandbox
You can login with your original login information plus the name of the sandbox.  For example, if my login was joey@example.com and my sandbox's name was "Dev" then I would login as joey@example.com.dev with my same password.  (Also, instead of login.salesforce.com, you use test.salesforce.com).

To create a Change Set, go to Setup > Deploy

Reach out if you need more direction!

Hugh RaineyHugh Rainey
Well thank you very much Bradley.

So I created the sandbox.  I had kinda thought when that was done it would mirror the objects that already exist in our production org.  That is not the case.   A couple of questions.

1) Is there a way to import the objects that we've created in our active org so that this work doesn't have to be duplicated?
2) If not, when I go to Deploy the change set, will the objects that I've created overwrite the existing objects, and will there be data loss?
AmitAmit (Salesforce Developers) 
Hello,

Refreshing a sandbox will duplicate the components into your sandbox. More information can be found at following link : 

https://help.salesforce.com/HTViewHelpDoc?id=data_sandbox_create.htm&language=en_US

http://help.salesforce.com/HTViewHelpDoc?id=data_sandbox_manage.htm&language=en_US

https://help.salesforce.com/HTViewHelpDoc?id=data_sandbox_implementation_tips.htm&language=en_US

https://help.salesforce.com/HTViewHelpDoc?id=create_test_instance.htm&language=en_US

Thanks,

Amit Bhardwaj
Bradley DelauneBradley Delaune
Hugh, Amit is correct.  Refreshing the sandbox will duplicate the objects, but that should've already come over when you created the sandbox the first time (double check your object model didn't come over).  Changes you make in production will not be automatically replicated in the sandbox.  A refresh is necessary (which will overwrite any changes in the sandbox).

Change sets never cause data or meta-data loss.  The only time loss in incurred is when you have changed something (in other words you overwrite existing data).  For example, if you create a field in production and a completely different field with a different name in the sandbox, then deploy the entire object, both fields will appear in production.  In the sandbox, only the field created there will exist.

I just reread your post and maybe you meant to say that your records didn't come over?  Yes, your records are not copied to a developer sandbox.  You can use the dataloader (Setup > Data Management > DataLoader) to export from production and import into your sandbox if you want actual data.  Keep in mind the storage in a sandbox is very small.  Typically you want to create new data from scratch to test with.
Hugh Rainey 9Hugh Rainey 9
Thanks Bradley and Amit.  

I checked right after Amit responded and the fields had ported over. I appreciate your guys fast response on these issues.  Nice community support.  

I've got a seperate question but I should probably ask it under a different post since it doesn't deal with the same issue.  Is that a good appropriate, or can I ask underneath this thread?
AmitAmit (Salesforce Developers) 
Hey Hugh,

It would be highly appreciated if you could post your query in a new post.

Also, if you could select the best answer, so that other can refer that for future reference.

Thanks,
Amit Bhardwaj