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