Regex Searching APEX Apps for use of Deprecated Features

Regex Searching APEX Apps for use of Deprecated Features

I wrote a story recently on deprecated APEX APIs and in there I wrote "You have to make proactive steps to resolve [deprecated APEX APIs]".

So how do you spot that you're using deprecated features so that you can be proactive? The Advisor is not advising and there is no such Utilities \ Resolve Deprecated Features option in APEX.

In this guide, I provide some regex's and instructions how to use them to search for deprecated API usage across both your APEX Apps and Repository.

Searching your APEX applications

  1. Log in to your APEX Workspace

  2. (optional) Click on an App you wish to search

  3. Click on the Search (or press CTRL+')

  4. Copy the below and paste into the search box.


    This is the 1st of two Regex's you have to use, due to the lovely ORA-12733: regular expression too long error.

  5. The screen will look super messy after pasting the string in

  6. If you look for the floaty-badge thingy on the right hand side, hovering over the results, it'll say Ctrl+3 or Ctrl+2.

  7. Click, or use the Ctrl+3 or Ctrl+2 keyboard shortcut for the one you want:

    • Ctrl+3 = Search Current Application

    • Ctrl+2 = Search All Applications

  8. It'll now start searching. When its finished searching it will return all the results with the deprecated APIs:

  9. Click the View button on each result and find an alternative approach.

  10. When you've finished, you'll have to start again with the 2nd Regex below...


    ...Although this time you can paste it directly into the search box here.

Searching your repository

For this part of the blog, I'm demonstrating using a test repository pretius-apex-lifecycle-aligned-sample-customers which is a derivative work of the APEX Sample Customers Application

  1. Open your repository in VSCode

  2. Click on the search icon 🔎 in the side panel

  3. Click the rectangle/star icon so that regular expressions are selected. See picture below

  4. In files to include select your source code folder, I'm selecting ./src/

  5. In the search box, paste in the following. This regex is the two regex's above combined, as VSCode does not have a problem with long search strings.

  6. The results will be shown as below

  7. Click each result to open the file (or drag the result to the right to open).

  8. ENJOY

What's the picture? Summer is coming to a park in Harrogate, UK.