Spoiler Alert: you need VS Code for this one
Just recently I had to deal with the following task. We have 200+ reports in an org. I needed to change the reference from all those reports to some fields. Imagine that in your reports you reference Lead.My_Custom_Field__c ( yes, I know, original... ) and you have that reference in let's say 100 of your reports. Now, you want to change all those references to Lead.My_New_Custom_Field__c for some reason ( somebody added that new field and you want to replace it with the old one ).... How do you do that? Ok, go to Reports, start opening every report one at a time and start adding the new filter field, remove the old one ..... naaaaahhhh just kidding :D Open your VS Code ( uh, told ya! ), add this extension if you don't already have it: https://marketplace.visualstudio.com/items?itemName=VignaeshRamA.sfdx-package-xml-generator
Create a new project with manifest Ctrl + Shift + P:
![](https://static.wixstatic.com/media/4620a7_acd1851fde434c99adbbb871d1d4bed7~mv2.png/v1/fill/w_753,h_80,al_c,q_85,enc_auto/4620a7_acd1851fde434c99adbbb871d1d4bed7~mv2.png)
Authorize your org Ctrl + Shift + P:
![](https://static.wixstatic.com/media/4620a7_afc1674d31a04164a5b79f62d8dda901~mv2.png/v1/fill/w_751,h_82,al_c,q_85,enc_auto/4620a7_afc1674d31a04164a5b79f62d8dda901~mv2.png)
Now, the magic begins, hit Ctrl + Shift + P ( surprise!!! ) in order to open the command pallet:
![](https://static.wixstatic.com/media/4620a7_5c9c545eaf6d4a5cbf02a8d61e2a68fe~mv2.png/v1/fill/w_747,h_476,al_c,q_85,enc_auto/4620a7_5c9c545eaf6d4a5cbf02a8d61e2a68fe~mv2.png)
Choose Metadata Components
Type in Reports:
![](https://static.wixstatic.com/media/4620a7_c48624a9e08a41a99e07bafd8c1c8ff4~mv2.png/v1/fill/w_540,h_423,al_c,q_85,enc_auto/4620a7_c48624a9e08a41a99e07bafd8c1c8ff4~mv2.png)
Mark all the reports that you want to change. You can also use the folder name as filter
![](https://static.wixstatic.com/media/4620a7_63af994869e14c0a92e198e6e89c4ab5~mv2.png/v1/fill/w_529,h_174,al_c,q_85,enc_auto/4620a7_63af994869e14c0a92e198e6e89c4ab5~mv2.png)
After you are done, click Update Package.xml
![](https://static.wixstatic.com/media/4620a7_584bfe694fd24e2082771b0f752a8935~mv2.png/v1/fill/w_656,h_81,al_c,q_85,enc_auto/4620a7_584bfe694fd24e2082771b0f752a8935~mv2.png)
If not opened automatically, go to manifest folder on the left, package.xml
![](https://static.wixstatic.com/media/4620a7_70064e2a194f4d49bdf3d4007c84e13f~mv2.png/v1/fill/w_281,h_385,al_c,q_85,enc_auto/4620a7_70064e2a194f4d49bdf3d4007c84e13f~mv2.png)
And you will see all of your report names added to the package.xml While on the screen of the package.xml, mouse right click and retrieve source from org
![](https://static.wixstatic.com/media/4620a7_dd998ee738d64216a112708e238f54cf~mv2.png/v1/fill/w_700,h_379,al_c,q_85,enc_auto/4620a7_dd998ee738d64216a112708e238f54cf~mv2.png)
You should be able to see all your reports metadata retrieved under force-app\main\default -> reports folder
![](https://static.wixstatic.com/media/4620a7_d304d49cd07e465491476d0314812341~mv2.png/v1/fill/w_316,h_388,al_c,q_85,enc_auto/4620a7_d304d49cd07e465491476d0314812341~mv2.png)
Next step, click Ctrl + Shift + H for global search and replace
![](https://static.wixstatic.com/media/4620a7_74675ac2a90346fe834b20eca50ea7ad~mv2.png/v1/fill/w_731,h_190,al_c,q_85,enc_auto/4620a7_74675ac2a90346fe834b20eca50ea7ad~mv2.png)
All the references for the field being searched will pop up and you can replace them easily with your new reference.
Keep in mind that the new field should be created in Salesforce otherwise you will get an error when deploying.
On the results that pop up, you can see the small button on the line with the result, if you click it, you will have your change deployed.
![](https://static.wixstatic.com/media/4620a7_420613217dfb4ca98c903d51c6255550~mv2.png/v1/fill/w_595,h_197,al_c,q_85,enc_auto/4620a7_420613217dfb4ca98c903d51c6255550~mv2.png)
*On this picture I am just showing what you can do and what can go wrong. In real life the search should be "Lead.My_Custom_Field__c" and the replace should be "Lead.My_Custom_Field_New__c".
Also, if you click in the line itself, you are presented with a nice spliced by two screen, for you to view the changes. Check how using just "Lead" as a search, can break the metadata, so be careful.
![](https://static.wixstatic.com/media/4620a7_11f426cfb0874a3cbdb576093e4994bd~mv2.png/v1/fill/w_980,h_454,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/4620a7_11f426cfb0874a3cbdb576093e4994bd~mv2.png)
I personally prefer to deploy them manually because sometimes you can update something that you don't want, or at least check the occurrences. ( Check my examples above again! ).
Imagine you are looking for My_Custom_Field__c, but you have also a Old_My_Custom_Field__c. If you don't get that one and you change them all automatically to My_New_Custom_Field__c, you will end up with
Old_My_New_Custom_Field__c
You see the difference? You will probably not be able to deploy it because you are missing a field like that, but still, errors can be produced, so be advised and be careful.
Have fun! :)
Comments