Posts

Showing posts from June, 2021

How to get calling menu name in extensions D365

We can write logic based on a current form called from which menu item. Following is the code that helps you to achieve  get the calling menu name.     ///     /// </summary>     /// <param name="args"></param>     [ PostHandlerFor ( formStr ( CaseItemCreditLines ), formMethodStr ( CaseItemCreditLines , init))]     public static void  CaseItemCreditLines_Post_init( XppPrePostArgs args)     {         SalesLine   salesLine;         FormRun     fromRun    =  args.getThis();         if (fromRun.args().dataset() == tableNum ( SalesLine )   && fromRun.args().menuItemName() == menuItemDisplayStr ( CaseItemCreditLines ))         {             salesLine = fromRun.args().record();             fromRun.design( 0 ).controlName( formControlStr ( CaseItemCreditLines , sendMail)).visible( salesTable ::isRelatedPO_IsVOR( salesTable ::find(salesLine.SalesId)));         }       }

Open URL in browser using X++

In this blog article, we will see how we can open a URL in a web browser using X++ code. It is achieved using Browser the class which extends System Class Browser having the only method navigate(). It has three parameters from which only first is mandatory: 1.        downloadURL (string) – URL you want to browse. 2.        openInNewTab (Boolean) – It is used to specify URL should be open in the same tab or new tab 3.        showExitWarning (Boolean) – Prompt a dialog to exit the current page. class OpenURL {    public static void main( Args _args)    {         Browser browser = new Browser ();         browser.navigate( SystemParameters ::find().DALPowerBILink, true , false );         //OR         browser.navigate( "https://jonesd365.blogspot.com/" , true , false );     } } So, this will open URL within a new tab in the browser using X++.