30 Jan Import object fields with Force.com IDE
A couple of months ago I was developing a merchant application for a client in Salesforce but at the time, despite being mostly completed it was put on hold (I am sure this has never happened to any of you :)). Due to large amounts of changes in the production org the development sandbox I was using to develop in had to be refreshed, and all of my work (which conflicted directly with an existing merchant platform) could not be deployed into production.
I was left worrying that weeks of work was going to go down the drain, but fortunately backing up salesforce metadata via the Eclipse IDE and force.com integration was pretty easy. So here I am several months later and I need to use some of that functionality now but my dev sandbox is missing all of that time consuming data models, objects, and fields I created several months ago.
While this may not be the best solution for importing object fields via eclipse, it sure worked for me, and unfortunately I could not find a guide to doing this on the internet, so I decided to write a blog article on it. Hope this helps someone looking to do the same.
- Eclipse IDE with force.com IDE plugin (https://developer.salesforce.com/page/Force.com_IDE_Installation)
- A metadata backup from Eclipse or compatible backup in a XML format.
- A current and existing force.com project with the necessary object metadata components.
- A object with the same API name as the desired imported fields object in the production or sandbox environment.
- This will overwrite a objects metadata, make sure you back up a copy before you do this!
- This may not work if the object fields are already referenced by dependent objects or code.
- You should probably not do this to a production environment.
- Open your IDE workspace through file explorer or finder (MAC). This is assigned when you open Eclipse the first time for the day.
- Copy and paste backed up version of object file to the objects folder of your current IDE workspace (YourWorkspace/ForceProjectName/src/objects).
- Allow the filed to overwrite.
- Open Eclipse IDE and access your project folder and the objects component folder.
- Right click on the object to upload, click the menu item “Force.com” and then “Deploy to Server…”.
That’s it! Your done.
Please leave you comments below, especially if there is something technically inaccurate, or you have a better way to do this! Thanks for reading.