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
Log in to your APEX Workspace
(optional) Click on an App you wish to search
Click on the Search (or press CTRL+')
Copy the below and paste into the search box.
regexp:(apex_background_process.abort)|(apex_css.add_3rd_party_library_file)|(apex_custom_auth.logout)|(apex_debug.log_message)|(apex_exec.execute_web_source)|(apex_exec.open_web_source_dml_context)|(apex_exec.open_web_source_query)|(apex_exec.purge_web_source_cache)|(apex_ir.get_report)|(apex_javascript.add_3rd_party_library_file)|(apex_page.get_ui_type)|(apex_page.is_desktop_ui)|(apex_util.get_application_status)|(apex_util.get_build_option_status)|(apex_util.get_global_notification)
This is the 1st of two Regex's you have to use, due to the lovely
ORA-12733: regular expression too long
error.The screen will look super messy after pasting the string in
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.
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
It'll now start searching. When its finished searching it will return all the results with the deprecated APIs:
Click the View button on each result and find an alternative approach.
When you've finished, you'll have to start again with the 2nd Regex below...
regexp:(apex_util.ir_clear)|(apex_util.ir_delete_report)|(apex_util.ir_delete_subscription)|(apex_util.ir_filter)|(apex_util.ir_reset)|(apex_util.public_check_authorization)|(apex_util.reset_authorizations)|(apex_util.set_app_build_status)|(apex_util.set_application_status)|(apex_util.set_build_option_status)|(apex_util.set_current_theme_style)|(apex_util.set_global_notification)
...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
Open your repository in VSCode
Click on the search icon 🔎 in the side panel
Click the rectangle/star icon so that regular expressions are selected. See picture below
In files to include select your source code folder, I'm selecting ./src/
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.
regexp:(apex_background_process.abort)|(apex_css.add_3rd_party_library_file)|(apex_custom_auth.logout)|(apex_debug.log_message)|(apex_exec.execute_web_source)|(apex_exec.open_web_source_dml_context)|(apex_exec.open_web_source_query)|(apex_exec.purge_web_source_cache)|(apex_ir.get_report)|(apex_javascript.add_3rd_party_library_file)|(apex_page.get_ui_type)|(apex_page.is_desktop_ui)|(apex_util.get_application_status)|(apex_util.get_build_option_status)|(apex_util.get_global_notification)|(apex_util.ir_clear)|(apex_util.ir_delete_report)|(apex_util.ir_delete_subscription)|(apex_util.ir_filter)|(apex_util.ir_reset)|(apex_util.public_check_authorization)|(apex_util.reset_authorizations)(apex_util.set_app_build_status)|(apex_util.set_application_status)|(apex_util.set_build_option_status)|(apex_util.set_current_theme_style)|(apex_util.set_global_notification)
The results will be shown as below
Click each result to open the file (or drag the result to the right to open).
ENJOY
What's the picture? Summer is coming to a park in Harrogate, UK.