Understanding the Issue: Cataclysmic Failure Screens
When an APEX application encounters a catastrophic failure, users are presented with a screen containing an error message instructing them to contact the application administrator. The message typically includes a debug ID for further investigation. However, it can be confusing for users and doesn't provide specific guidance on resolving the issue.
Locating the Translatable Message
To begin addressing this problem, it is essential to identify the source of the error message. In Apex, the message is stored as a translatable message value within the application translations. These translations are located in an application labeled (application ID 4411) within the Apex workspace. Even more useful, though, the messages are in the table apex_application_translations. I have created an application to let you search through them:
Accessing the Translatable Message
Accessing the information regarding the translatable message requires a privileged user with the admin role to query the internal translator. While it is possible to update the message directly, this change would apply globally to the entire instance. Fortunately, there is a better approach that allows developers to override the message for their specific workspace.
Overriding the Error Message
To override the error message just for your application, take the following these steps:
Navigate to your application and add a new text message.
Use the translatable message value associated with the error message, such as
Customize the message by adding the desired text, such as "Contact Mishka," and include
%0as a placeholder for dynamic content.
Save the changes and run the application again to verify the updated error message.
Benefits and Considerations
Overriding translatable messages offers several advantages for developers and administrators:
Provides more specific and user-friendly error messages.
Improves the user experience by eliminating confusion and offering clear instructions.
Allows customization of messages in different languages.
Enables developers to update various translatable messages within the application, such as action prompts.
However, it's important to note that the documentation on overriding translatable messages in Apex is incomplete and does not explicitly mention the ability to override messages in the same language. Additionally, although there are numerous translatable messages available, not all of them are listed in the official documentation.
Further Use Cases
Apart from addressing catastrophic failure screens, overriding translatable messages can be useful in other scenarios as well. For example:
Modifying labels or prompts within the application to match specific requirements.
Customizing messages for different user roles or permissions.
Enhancing the overall user interface by tailoring messages to fit the application's branding or style.
Apex developers and administrators can take control of error messages and provide more precise guidance to end users. Overriding translatable messages offers a powerful tool for improving the user experience and ensuring that error messages are informative and actionable. Although the official documentation may lack comprehensive details, this technique is accessible and highly valuable for enhancing Apex applications.
Remember, understanding how to override translatable messages empowers you to deliver exceptional user experiences, leading to increased user satisfaction and overall application success.
You can follow along at APEX Instant Tips #86.