edivam
21 January 2020 19:25
1
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?
pgr
22 January 2020 15:57
2
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.
edivam
22 January 2020 17:38
3
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.
pgr
22 January 2020 17:57
4
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.
edivam
23 January 2020 11:08
5
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!â);
lukio
12 January 2021 10:59
7
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!