Tuesday, December 26, 2023

Export all Custom Metadata Records in CSV file using Apex

Using apex, we can export all custom metadata records in CSV files. This is sometime needed if we want to review all custom metadata records after sandbox refresh or to check the dependency of any field or attribute in all custom metadata records.

Below is apex class which can be used for this and once you execute its method from developer console, you will receive email with csv that contain all custom metadata records.

Open developer console and open execute anonymous window. Execute below script:


Below is snapshot of csv file:


  • This script will specify the custom metadata field api name and its value seperated by "&SK&" delimiter.
  • All fields and its values are seperated by comma.
  • You can modify this method to fetch all custom metadata related to installed packages by specifying a parameter for namespace.

Hope this will help!!



  1. 🇧🇷🇮🇴🇻🇬🇧🇳🇰🇭🇧🇮🇧🇫🇧🇬Highly Recommended!
    Very insightful, i will also say this here. Investment is one of the best ways to achieve financial freedom. For a beginner there are so many challenges you face. It's hard to know how to get started. Trading on the Cryptocurrency market has really been a life changer for me. I almost gave up on crypto at some point not until saw a recommendation on Elon musk successfully success story and I got a proficient trader/broker Mr Bernie Doran , he gave me all the information required to succeed in trading. I made more profit than I could ever imagine. I'm not here to converse much but to share my testimony; I have made total returns of $10,500.00 from an investment of just $1000.00 within 1 week. Thanks to Mr Bernie I'm really grateful,I have been able to make a great returns trading with his signals and strategies .I urge anyone interested in
    INVESTMENT to take bold step in investing in the Cryptocurrency Market, you can reach him on WhatsApp : +1(424) 285-0682 or his Gmail : BERNIEDORANSIGNALS@GMAIL.COM, bitcoin is taking over the world, tell him I referred you🇨🇲🇨🇦🇨🇻🇮🇨🇧🇮🇧🇦🇧🇴🇧🇹

  2. Shapoorji Pallonji BKC 28 real estste new design idea all to provide a contemporary and how like living space and enhancing the best skyline.
    Residential quality looking brands focus on high-quality living and offer residential, make luxury commercial, or a great class of new mixed-use areas. The goal of the best project is to provide a thriving with well-planned housing, facilities, and natural environments that best good time help the quality of life.


  3. Hello! I recently stumbled upon an informative post that I think you might enjoy reading. Also, have you had a chance to check out the latest stainless steel 410 plates, 347 stainless steel sheet suppliers, and 347h stainless steel sheet? They are definitely worth looking into!

  4. QUICK EASY EMERGENCY URGENT LOANS LOAN OFFER EVERYONE APPLY NOW +918929509036 financialserviceoffer876@gmail.com Dr. James Eric

  5. It was very Nice. This is a great blog I have read.
    Digital Marketing Agency.

  6. Myron Royal Crest is the next big investment corridor in digwal hyderabad. Invest now and watch your investment grow in the years to come! Myron royal crest with ultra luxury amenities & more options.
    Open Plots In Digwal Hyderabad
    For More Details Contact : 7799949109

  7. MonkTaxSolutions is providing outsourced accounting services with tax preparations & payroll services, etc. Switch to an affordable accounting solution today. Our team will manage the whole process. Our team of professional bookkeepers and accountants provides the services that clients need, with our rates typically 50% less than the equivalent service. Speak to us today!

    Visit - https://monktaxsolutions.com/

  8. Exporting all Custom Metadata Records to a CSV file using Apex involves writing an Apex class to query the Custom Metadata records and then generating a CSV file format from the retrieved data. You can utilize the Metadata namespace and CSVWriter classes for this task. This is a useful approach for migrating metadata configurations or backing up your custom settings.

    And Plz Visit my Website:- Car Transport Quote Services

  9. Your blog has quickly become one of my favorites. The depth and quality of your content are truly impressive. Looking forward to your next post! plan to visit - day outing places in gurugram, papnoghar resort gurgaon is best place for day event near delhi.