Detect what event a BOI script is triggered by?

I ran into a scenario where I need to do things different from a Pre-Totals event, vs Column Post Validate events, all within the same script.  Easily enough, there is the "column" variable passed into an event script, which will be blank for the Pre-Totals trigger.

This made me think about what other such variables might exist.  I know of only two: "value" and "column".  Are there any others (like the event trigger which started the script)?

  • I use oScript.GetCurrentProcedure() to return current event / procedure. Note for column events it's separated with _ char. So it returns these values:

    PreTotals, PreWrite, PostRead, PreDelete, PostDelete, SetDefaultValues, ScriptInit
    PostValidation_ItemCode
    PostValidation_UDF_KevRocks1
    PretValidation_UDF_KevRocks2

    ALSO, if you look at the business obj VBS file that's how you know what it exactly returns (how I fumbled over that it's PostValidation_Blah and PreValidation_Blah as opposed to PostValidate_Blah and PreValidate_Blah)

    ALSO, when checking it could be for helpful for comparison to UCase or LCase.
    e.g. If UCase(oScript.GetCurrentProcedure()) = "PRETOTALS" 

    For other stuff if you do the OBJ trick and look at Sy_Script you'll see stuff that could be usable:

    * RefCount could be helpful. Use it on some DebugPrint's to see what it does. 
    * UIObj (under Properties / Numeric is very helpful. If not 0 it means you can do UI scripting on it. IOW when you're checking to see if you're in a UI it's oSession.UI but to see if you can also use oUIObj stuff on it, check for both:
    If oSession.UI and oScript.UIObj Then go fish

  • in reply to Alnoor

    As always your answers and insights are excellent Alnoor.  Thanks!

    oScript.GetCurrentProcedure() is much better for what I am trying to achieve.

    (I'll be sure to take a look at RefCount / oScript.UIObj too).