This is very good article on How to Access Form Menu from Global Scripts, from Patrick Roth, on Developing for Dynamics GP blog.
I have done exactly the same with VBA and Continuum API (My Article: SOP Entry – Defaulting Add Item Menu Option), but that was sort of a wrokaround and not as good as this method in DEX. This is an important article for all Dex Developers. Also make sure that you read Mariano’s query and Patrick’s reply (as comments to this article). That’s added information.
Thanks Patrick to share with us such a precious information.