trigger logic hook in mass update

I created a logic hook in custom/modules/Accounts with after_save trigger. However I need to trigger the same logic hook during mass update.
How can I do that?


After_save logic hooks also trigger when the change is being made from a Mass Update. So you don’t have to do anything extra, your hook should run (if it is properly defined).

I think the problem is that it did not trigger the logic hook. What my logic hook does is:
after_save it connects to external integration script to upload single account data into 3rd party application.

when I edit and hit save of existing account it connects without issues.
when I add new account it doesn’t connect
when I do a mass update is also doesn’t connect.

I did check the logs to see the ids that were sent and in those 2 cases the logic hook is not being triggered

Can you put a log statement to write something in the log as soon as the logic_hook is triggered? This is a better solution to know if it is being triggered than relying on the result of a more complex process (which could have bugs in itself)

Can you specify what you meant ‘properly defined’.

I added this peace of code in /custom/modules/Accounts/logic_hooks.php

$hook_array['after_save'][] = Array(
    'export Account after save', // label
    'custom/modules/Accounts/exportAccount.php', // file
    'exportAccount_LogicHook', // class
    'export' // function

this code is triggered only when I edit the existing account information. Its not triggered on new account or mass update.
The code is designed for a single account only.

To see if the logic_hook file is correct I would need to see all of it, not just that part. But it looks correct - if those names match the file, class and function you’re using.

Put this in the first line of your hook function:

  $GLOBALS['log']->fatal('Entering hook exportAccount_LogicHook');

And then re-check, using the suitecrm.log, your diagnosis of when the hook is firing or not.

I actually managed to make it work. For some strange reason when I used GLOBAL variable it caused an issue.
I still can’t figure out as to why that is. But I removed that piece of code and it works just fine.