AOW action trigger on imported data

…firstly, congrats to the SalesAgility and Sugar teams for such a great product! I am looking for something to replace a customised CRM solution and suiteCRM looks amazing! :stuck_out_tongue:

I have been trying to use a AOW process to update a record when a field is updated via a csv import and it doesn’t seem to be working. I was wondering if this is a limitation of the current product or if I am implementing incorrectly?

I have successfully applied my AOW process when I edit a record normally through the suiteCRM interface - so it does work. Screenshot of my rule below:

I am on suiteCRM Version 7.1.5

Thanks!

It may be that the import doesn’t actually fire the “Modified Records” workflows. One possible workaround for this could be to switch the “Run On” to “All Records” and add a custom field (import_updated or something like that) which the workflow checks.

Thanks,
Jim

Thanks for the quick advice Jim. I just modified my workflow to run on ‘All Records’ and tried a test on the ‘title’ field (just to see if it would work) - but same result, where the import fails to trigger the workflow, but a direct edit does. Update screen shot:

In response to salesagility reply on my duplicate thread (https://suitecrm.com/forum/suitecrm-7-0-discussion/3758-aow-to-trigger-on-imported-data#14710)

“Is the scheduler running?”

Yes - it seems to be, but now you mention it, I want to clarify a few things about the scheduler.

  1. I thought the scheduler was only required for time based AOW? It seems that when I edit the records directly, the AOW process workflows are trigger instantly without the scheduler running

  2. I am running the scheduler using the mentioned batch file in windows 7:
    cd G:\wamp\apps\suitecrm-7.1.5-max
    php.exe -f cron.php

I can see the ‘Run AOW WorkFlow’ processes being run in the ‘job log’ history - so it seems OK, although I am getting many of the “PHP Notice: Undefined index: module in…” messages in the command line window when it runs - but from what I have read on the forums - these can safely be ignored - is this true for the scheduler as well? (I have already turned off display notices in PHP so they don’t appear in the UI).

  1. Any other ideas as to why the import is not triggering the AOW?

I will switch on more detailed PHP logging in suiteCRM and see if that shows anything else during the import or the scheduler runs.

Hi All,

I debug this issue at code level that why workflow action doesn’t trigger when import data and found that …

In AOW_Workflow.php bean file there is method with name “run_bean_flows” that has condition at first place which check if module name is not set OR has value ‘Import’ then do nothing else run the action. I attached the screenshot for reference.

If we remove this condition it works for import data as well. B)

Thanks.

Hi there! Canyou tell us how exactly did you adjust the source code?
I’ve tried to remove the OR condiction, but it didn’t help, broke the functionality.

Any help will be appreciated, this is critical for me, thanks!

You can change this line

if (!defined('SUGARCRM_IS_INSTALLING') && 
   (!isset($_REQUEST['module']) || $_REQUEST['module'] != 'Import')) {

to simply

if (!defined('SUGARCRM_IS_INSTALLING')) {

This change is not upgrade-safe, you might need to re-do it after some upgrades.

@pgr thanks a whole lot.

I’ll try this and will come back with the result!

@pgr the solution worked!

It imports, it creates all contacts and it triggers all workflows. The only inconvenience is that now I am not able to see the Import Wizard result screen (error below). I tried to find a solution with no success.

Well, for now the result screen is less important than triggering the workflows, so I’ll keep this error as is until I have to fix it. If someone knows the fix, please be kind enough to share :slight_smile: