Skip to main content

Command Palette

Search for a command to run...

APEX 24.2: New Text Messaging Features

Updated
3 min read
APEX 24.2: New Text Messaging Features
J
Hi, thanks for stopping by! I am focused on designing and building innovative solutions using AI, the Oracle Database, Oracle APEX, and Oracle REST Data Services (ORDS). I hope you enjoy my blog.

Introduction

APEX 24.2 introduced several new marquee features. These were mainly focused on AI RAG, Vector Search, and Fusion Integration improvements. This post will focus on a small but significant change to how Text Messages can be used in APEX. Text Messages are essential because they keep end-user messages out of your code where they are harder to maintain. More importantly, APEX Text Messages allow seamless translations for multilingual applications.

💡
Although your application may not be multilingual today, using APEX Text Messages instead of hard-coding messages in your code is still a best practice. You will thank me later!
Ensure you read the entire post; the final section has an important deprecation.

Changes in APEX 24.2

Let’s start by creating a Text Message to test with:

Example Oracle APEX Text Message

Named Parameters

You can now include named parameters in your text messages instead of %0, %1, etc. This makes the message much more readable. In the screenshot above, I have included a single names parameter called PHONE_NUMBER. As with the old approach, named parameters must be prefixed with a %.

Comments

There is a new Comments field where you can describe what your text message is used for.

Subscription

You can now subscribe to text messages.

Text Message Picker

The text message picker is a great new feature. Before this feature, I would find myself with two open tabs, copying and pasting text message names from one window to another. Now, you can select Text Messages right from the builder!

Enabling Text Message Picker

Enable the text message picker from the Utilities menu → Show → Text Messages Picker.

Enable Oracle APEX Text Message Picker

Once enabled, globe icons appear on properties that allow text message substitution. Pretty neat!

Select and Oracle APEX Text Message using the Text Message Picker

After selecting a text message, APEX inserts the text message and any parameters into the property field.

Image showing the result of picking a Text Message using the Text Message Picker

  • The Text Message variable PHONE_NUMBER is included in the message syntax. This is initially set to ““; in my example, I have added a reference to the page item &P1_PAGE_NUMBER.

  • The new Text Message syntax is a little shorter and much easier to read than the old syntax, and adding parameter substitutions makes these changes quite useful.

The Result

At runtime, APEX substitutes the Text Message and the parameter.

Oracle APEX Text Message Substitution Result

PL/SQL API Changes

In previous versions, we would use APEX_LANG.MESSAGE to get the text from Text Messages in PL/SQL. A quick look at the documentation for APEX 24.2 will tell you that this API has been deprecated in APEX 24.2. Instead, you need to start using APEX_LANG.GET_MESSAGE.

🤮
I am not looking forward to the day when I will have to go through all the code I have ever written and change out APEX_LANG.MESSAGE to APEX_LANG.GET_MESSAGE!

As you can see from the example below, the signature for apex_lang.get_message is quite different:

DECLARE
  l_message  VARCHAR2(1000);
BEGIN
  l_message := apex_lang.get_message 
    (p_name   => 'PHONE_NUMBER_VALIDATION',
     p_params => apex_t_varchar2 ('PHONE_NUMBER', :P1_PHONE_NUMBER));
  apex_debug.info (l_message);
END;

Conclusion

APEX 24.2 introduces several improvements to Text Messages, including the ability to use named parameters, a new Comments field to describe text messages, subscription features, and a convenient Text Message Picker. These enhancements make text messages more readable and easier to manage, while supporting seamless integration and multilingual capabilities in applications.

Time to get started on planning the remediation effort for changing APEX_LANG.MESSAGE to APEX_LANG.GET_MESSAGE!