How to show message onload

Dear, good afternoon!
I would like to know can help me on a question:

I wonder:
How does the system display an alert after clicking the “CREATE” button in FP_EVENTS?

I am trying to use ‘LOGIC_HOOKS’ to do this. Nothing Happens!

Location -CLASS:
custom/modules/FP_events/popup_warning_event.php

       <?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
   
    class popup_warning_class
    {
        function popup_warning_method($bean, $event, $arguments)
        {
          

App.alert.show('message-id', {level: 'error',title: 'error',messages: 'Test',autoClose: false,});

           
			 }
        }
    }
?>

LOCAL - LOGIC:
custom/Extension/modules/FP_events/Ext/LogicHooks/popup_warning_event.php

        <?php
$hook_array['after_ui_footer'] = Array();
$hook_array['after_ui_footer'][] = Array(
						1,
						'onload Fp_events create',
						'custom/modules/FP_events/popup_warning_event.php',
						'popup_warning_class',
						'popup_warning_method'
);

What’s wrong with my logic?

What is that App.alert.show you’re using? Are you trying to use Javascript in a PHP file?

Maybe this will be of use:
https://docs.suitecrm.com/blog/creating-an-alert/

If you want to be synchronous (appear immediately on screen) you have to search for help to “inject javascript” into a view.

oops! Only now did I realize that I tried to use javascript in php. My mistake. = (

This option presented is interesting! But can I insert this code?
Can I perform a php query between these options?

The goal is to alert the user not to duplicate the data in the event module.

You can execute any PHP in a logic hook, and use the Beans for your queries.

If you really need direct SQL access, you can also do it.

But I am not sure if this particular hook will work for you for this purpose, or if the alerts through the top menu are what you want.

Normally validations are either put in before_save hooks (but hooks run in the back-end, so no alerts from there are possible), or from the other (completely different) technique called Javascript injection, which controls things form the front-end.

Really! Using system alerts makes more sense. I will explore this area.

Thanks!!!

An easy way to Display any Alert/Warning message as the CRM displays for the Missing Email settings can be displayed by using following method.

SugarApplication::appendErrorMessage(‘Here is an Important Alert!’);

Hi, instead of use logic hooks, why note implements pre_save methods of the Bean?
From there you can send alerts as @cherub-chum explained.

Cheers!