Menu
SuiteCRM Pull Request Party hosted by SalesAgility
Welcome, Guest
Username: Password: Remember me

TOPIC: After_save hook in the Meetings is fired repeatedly

After_save hook in the Meetings is fired repeatedly 1 month 4 days ago #75515

  • reznik
  • reznik's Avatar
  • Offline
  • New Member
  • Posts: 11
  • Thank you received: 1
  • Karma: 0
Hi everyone!
I have a simple after_save logic hook in the Meetings module. Here is my hook:
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class Custom_Logic_Hooks
{
    function after_save_method($bean, $event, $arguments)
    {
	$GLOBALS['log']->fatal('Calling after_save_method');
    } 
} 
The hook does nothing but adds a line to the log.
When I create a new meeting the hook is fired and everything is okay.
The problem occurs when I open an existing Meeting, change an Account related to the Meeting and save the record. My hook is being fired many times (until timeout). The suitecrm.log looks like
Thu Dec 13 07:37:36 2018 [2396][84469463-e384-dce2-ea60-59424cf71c08][FATAL] Calling after_save_method
Thu Dec 13 07:37:38 2018 [2396][84469463-e384-dce2-ea60-59424cf71c08][FATAL] Calling after_save_method
Thu Dec 13 07:37:39 2018 [2396][84469463-e384-dce2-ea60-59424cf71c08][FATAL] Calling after_save_method
Thu Dec 13 07:37:40 2018 [2396][84469463-e384-dce2-ea60-59424cf71c08][FATAL] Calling after_save_method
...

If the Meeting has a relationship with a Contact the hook works fine (even if the related Contact is changed).
Well, the Accounts module has some after_relationship_add hooks but turning them off brings nothing. If I use before_save hook in Meetings the problem is the same.
Does anybody have an idea why my hook is called repeatedly if the related Account is changed? Thank you.
P. S. SuiteCRM version is 7.8.2
The administrator has disabled public write access.

After_save hook in the Meetings is fired repeatedly 1 month 3 days ago #75521

  • pgr
  • pgr's Avatar
  • Offline
  • Administrator
  • Posts: 8789
  • Thank you received: 1337
  • Karma: 323
3 possibilities:

1. Your version of SuiteCRM is very very old and contains a bug

2. You are saving the hook file in the incorrect place (maybe you can tell me where it is and I can help with this)

3. You have a workflow running when this record is saved, and it is interfering

My SuiteCRM In-depth blog.
Thank you for always stating your SuiteCRM version, checking your logs, reading the Docs, and searching before you ask!
The administrator has disabled public write access.

After_save hook in the Meetings is fired repeatedly 1 month 2 days ago #75576

  • reznik
  • reznik's Avatar
  • Offline
  • New Member
  • Posts: 11
  • Thank you received: 1
  • Karma: 0
pgr wrote:
3 possibilities:
1. Your version of SuiteCRM is very very old and contains a bug
2. You are saving the hook file in the incorrect place (maybe you can tell me where it is and I can help with this)
3. You have a workflow running when this record is saved, and it is interfering

Hi, pgr!

Now I have an absolutely new out-of-the-box instance of SuiteCRM 7.10.11.
My hook (custom/modules/Meetings/Meetings_cstm.php) is still the same
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class Custom_Logic_Hooks
{
    function after_save_method($bean, $event, $arguments)
    {
	$GLOBALS['log']->fatal('Calling after_save_method');
    } // function
} // class
I open a Meeting, edit the record and save the record.
If the related Account is changed and the Meeting has a reminder, the hook is fired 4 times.
If the related Account is changed and the Meeting has no reminder, the hook is fired 3 times.
If the related Account is NOT changed and the Meeting has a reminder, the hook is fired 1 time (just as many times as it's supposed to be).
If the related Account is NOT changed and the Meeting has no reminder, the hook is fired 1 time (which is also OK).

Looks like the record is changed while being saved and that launches the hook again and again. I wish I knew why!

Thank you.
Last Edit: 1 month 2 days ago by reznik.
The administrator has disabled public write access.

After_save hook in the Meetings is fired repeatedly 1 month 2 days ago #75600

  • pgr
  • pgr's Avatar
  • Offline
  • Administrator
  • Posts: 8789
  • Thank you received: 1337
  • Karma: 323
You are probably getting some interference from the locations described here

docs.suitecrm.com/developer/logic-hooks/...your_own_logic_hooks

My SuiteCRM In-depth blog.
Thank you for always stating your SuiteCRM version, checking your logs, reading the Docs, and searching before you ask!
The administrator has disabled public write access.
Time to create page: 0.120 seconds
Powered by Kunena Forum