Calling Action from a grid or a form. May I know where I call from?.

Hello, I have a question, I have an "Action" which I can call either from the menu, the grid, or from the form. Is there any way to know from where I call that "Action"?. I need to differentiate it to execute one part of the code or another.

Too many thanks!!!!