Updating reports with Eclipse and the Force.com IDE
I came across a question on the Salesforce.com Answers forum today and thought the answer might be useful to others.
Here is the original question: http://bit.ly/k3nKHD
The question concerned updating reports after a new Stage was created on the Opportunity Object. Once the new stage was created and Opportunity records had been updated to use that new stage, any reports leveraging the old stage in their filters would be broken. The poster of the question was hoping there was a faster way to identify the reports that filtered on that stage than opening each report individually. I suggested using Eclipse and the Force.com IDE along with Notepad++ to get things done. This will work with much more than just Stage, so insert your own search terms as desired.
The following assumes that you are already comfortable with Eclipse and the Force.com IDE:
The first thing you will want to do is download all of your report metadata to Eclipse. If you have reports that are in Production and not your Sandbox then you will need to connect to your Production environment or refresh your Sandbox first. If you do need to connect to Production just BE CAREFUL.
- Create a new project
- Include ‘reports’ or more specifically the report folders you are concerned with
- Let Eclipse refresh the project with the reports metadata
- In Eclipse, navigate to the reports folder you just download. Right click and select properties
- Highlight and Note (or copy) the Location. This is the path where the metadata files are located
- Open a windows explorer window and navigate to the path you just copied
- Open Notepad++ click Search > Find in Files (or just Ctrl+Shift+F)
- Enter your search term (in our case, the Stage) , make sure the ‘In all sub-folders’ box is checked and click the ‘Find All’
- A message will pop up saying “Searching… Press Enter to Cancel”. Don’t touch anything, just let it do it’s search, this may take a little while depending on how many files you have. Clicking OK will cancel the search.
How do I use the Eclipse IDE to update report fields? I have a new field that is replacing an existing field on about 35 reports and would like to do a mass update the field on those reports via the force.com IDE, but am not finding how to do that. Thanks!
JoAnn Culbertson
May 4, 2011 at 1:07 pm
Hi JoAnn. Once you have downloaded the metadata and identified the report files that need updating, make a backup of those files.
Now that you have a backup, you can edit the original files. Locate the field (it will be the API name) which you want to replace. For example if you had a field called District which you want to replace with Region you would locate District__c and replace it with Region__c.
Save your file and then in Eclipse, right-click on your Project (or reports folder within the project) and click refresh. I do this to ensure that the file in eclipse is definitely up to date.
Now that you have an updated file, you need to get this into production. If you initially connected to Production you can simple right click on the report or report folder, select Force.com > Save to Server. If you initially connected to a sandbox, you will still want to save back to the sandbox, but you will also need to deploy the changes to production. Right-click as before but instead select “Deploy to Server” and follow the steps to deploy to your production account.
My recommedation is to use the latter process so you can check your changes in the sandbox before deploying to prod.
Good Luck!
knthornt
May 4, 2011 at 2:34 pm
I would like to be able to create a new Report folder, say its called ARchived Reports, and then move a bunch of reports into it using the IDE. Is that possible?
Thanks!
Brandy Colmer (@forceDotMom)
August 10, 2011 at 4:42 pm
I am coming up short on this one Brandy. I have been unable to come up with a solution, but will continue to think about it. Hopefully I can figure it out for you. It would seem to be possible though I am struggling to this point.
knthornt
August 11, 2011 at 9:08 am
Actually, I just found this from the infamous matt brown: http://success.salesforce.com/questionDetail?qid=a1X30000000IEOSEA4
However, I am using a Mac and a .DS_store file gets automatically created which gets picked up by eclipse and does cause an issue which is why I am struggling. If you have access to a PC that may be your best bet.
knthornt
August 11, 2011 at 9:15 am
Muchas Gracias!
Brandy Colmer (@forceDotMom)
August 11, 2011 at 1:52 pm
what all things to be done before downloading force.com ide ,please help me out
atif
October 4, 2011 at 6:49 am
You can download the ide from this link
Chris O Davies
October 9, 2011 at 2:08 pm
Hi Brandy,
I am also doing a report Cleanup similar to yours, please see the instructions below on how to move reports from one folder to another. Hope this helps.
Create a new project
Include ‘reports’ or more specifically the report folders you are concerned with
Let Eclipse refresh the project with the reports metadata
In Eclipse, navigate to the reports folder you just download and then select the Report Folder you want the reports you want to move from, right click and select Properties
Take Note of the Location. This is the path where the metadata files are located
Open a windows explorer window and navigate to that path
Highlight all the Reports you want to move and right click Cut
Still in the Window explorer navigate back to the list of report folder and expand the one you want to move the reports to and right click and Paste
Now back in the IDE highlight the folder titled Reports and right click and Refresh and then right click again and Force.com>Save to Server
BOOM! Now you have moved your reports.
Jim Kelly
December 7, 2011 at 5:25 am