How to find caller of a logic hook

[color=#000000][size=5]Suppose we have a before save logic hook on leads, now How we can detect if this called logic hook is:

I have checked some of the behaviors, it seems logic hooks are not called on workflows (at least in my test)
Also I hope to figure out this issue in global variables, but there are a lot of global variables.
So How I can detect caller of a logic hook ?

The simplest and uograde safe way is to edit your logic hooks and add a log of what it is doing.

In addition, if you want to understand where logic hooks are called you can search for the string ‘call_custom_logic’ in all the files of you instance. The method is defined in the SugarBean and LogicHook classes.

1 Like

That’s what I did eventually, know I share some of my observations so it may help the others (these are statements, based on the case some of them may applies)1. in third party entry point calls $_SESSION is empty, in direct entry point calls is not so

  1. rest calls have $_REQUEST[‘rest_data’] and others don’t.
  2. entry point calls have $_REQUEST[entryPoint] available in the array
  3. global $current_user is available, but the id var ($current_user->id) is set only in the case a user is submitting a form in crm.
  4. in inline editing $_REQUEST[action] is equal to saveHTMLField
  5. in user calls $_SERVER[HTTP_USER_AGENT] is available and in other calls it is not.
    There are several other results, but I hoped to find a clean answer!