All posts

Search your Salesforce org’s metadata with ChatGPT

Wouldn’t it be cool if you could search your Salesforce codebase using ChatGPT? Imagine asking it questions like:

Wouldn’t it be cool if you could search your Salesforce codebase using ChatGPT? Imagine asking it questions like:

  • “Where in my org’s metadata is custom_field__c referenced?”
  • “How many lookup relationships are we using on Case?”

Turns out, you can do that — and it’s surprisingly easy. This post walks you through the whole process.

⚠️ Quick disclaimer: I’m not responsible for any hot water you get into with your IT department if they find out you’re dumping metadata into ChatGPT. Your metadata is

probably not critically sensitive and protected data, but that’s your risk to take.


Step 1: Download Your Metadata

The first step is grabbing the metadata you want to query. I recommend being selective here — pulling everything will take forever and most of it won’t be useful.

Useful Metadata Types

Here are the ones I’ve found most valuable for querying in ChatGPT:

  • Custom Objects
  • Custom Fields
  • Apex Classes and Triggers
    • Flows (Flow Definitions and Flow Versions)
  • Workflow Rules (if still in use)
  • Workflow Email Alert (may be invoked by Flows in some orgs)
  • Classic Email Templates
  • Queues
  • Assignment Rules
  • Permission Sets and Permission Set Groups
  • Validation Rules
  • Layouts
  • Profiles
  • Approval Processes

You can use any tool you want to retrieve this, but my go-to is Jetstream. It’s simple, intuitive, and doesn’t require you to mess with XML configs or the Salesforce CLI.

How to Download Metadata with Jetstream

  1. Go to Jetstream and create an account.
  2. Connect to your Salesforce org via OAuth by clicking “Add Org”.
  3. Click Deploy MetadataDeploy and Compare Metadata.
  4. In the retrieval config:
    • Column 1: Choose metadata types (like ApexClass, CustomObject, Flow, etc.).
    • Column 2: Keep as “All Users”.
    • Column 3: Set date filter to “Any Date” (unless you want only recent changes).
    • Managed Packages: Start with “Unmanaged Only”.
  5. Hit Continue.
  6. Select specific metadata:
    • Browse and check off what you want — or collapse a section and hit “Select All”.
  7. Click Download Metadata.
  8. A zip file will be created and downloaded to your computer.

You’ll see progress in the upper-right notification bar. When it says “Package downloaded successfully,” you’re good to go.

Step 2: Create a Custom GPT That Knows Your Org

Now that you’ve got your metadata, it’s time to create a custom GPT model and upload that data into its memory.

Note: You’ll need a ChatGPT Plus account to create custom GPTs. At time of writing, it costs $20/mo.

Steps to Create Your GPT

  1. Go to chat.openai.com/gpts.

  2. Click Create a GPT and walk through the GPT builder.

  3. Give it a name like “Salesforce Metadata Buddy”.

  4. When prompted to upload files, drop in the contents of your metadata zip. ChatGPT can unzip zipped files, but you have to explicitly tell it to do so and it doesn’t always work. It’s better to unzip it and drop in all of the unzipped folder contents directly.

  5. In the instructions for your GPT, write something like:

    “You are a Salesforce expert who helps users query and explore org metadata. Use the uploaded files to answer questions about fields, relationships, Apex classes, flows, etc. You might be asked to locate a specific field across all of the attached files, for example.”

That’s it! Your GPT now knows about your org.

Step 3: Start Asking Questions

Now for the fun part — start chatting! Try questions like:

  • “What flows update Case records?”
  • “Where is custom_field__c used in Apex?”
  • “Which objects have more than 5 lookup relationships?”
  • “List all profiles that have View All Data enabled.”

The GPT will search through the uploaded XML and give you human-readable answers — way faster than digging through your metadata manually.

Wrap-Up

This little hack turns ChatGPT into a powerful metadata assistant for your Salesforce org. It’s fast, surprisingly accurate, and can save you a ton of time navigating complex setups.

Just remember to keep your company’s data policies in mind and avoid uploading anything sensitive.

Of course, as with everything on ChatGPT, it should be taken with a grain of salt and may not be perfect. It may take some iterative prompting to get to the answers you’re looking for. But, it’s a great place to start and can provide value.