Passing custom information to logic hooks?


I have a logic hook “after_save” with one of my custom modules. The issue I am having is that I have both a cron job running (and saving records) as well as the normal edit functionality within SuiteCRM.

Now, I only need the logic hook to run when its coming from within suitecrm (and not the cron job).

One workaround I have is to set a config variable in the database to identify if the cron job is running and I subsequently check this in my logic hook. But this presents a problem when somebody saves using the normal edit page within suitecrm while the cron job is running as well.

The third argument of the after_save hook, “arguments”. Can we pass some data in there perhaps?

Any solutions are welcome. Thanks! :slight_smile:

I would add something like this to the before save

if ($_REQUEST [‘module’] != '‘YOURMODULE’) return

That should only now run when saved from an edit


That works. Thanks! :slight_smile:

Still unclear if we could pass an argument to the save() method and then see it inside the after_save logic hooks method. Like ‘$bean->save(“xyz”)’ I guess I can figure it out by looking at the main sugar bean class but if someone already dealt with this pls let me know