How to Open External URL in D365 Using X++ Code

0

How to Open External URL in D365 Using X++ Code


If you want to navigate the user’s browser to a different URL programmatically (and not by providing a link they can click) this can be done very easily by using the new class Browser. With the new version of Dynamics AX or D365, there are new APIs that are needed because of technological changes.

...

class ExternalURL
{       
    /// The specified arguments.
    public static void main(Args _args)
    {
        Browser browser = new Browser();
        browser.navigate('http://www.google.com', true, false);
    }
}

...

The Browser class only has one single method, navigate, which has three parameters (of which only the first is mandatory):

     - URL (string)
     - Prompt (boolean)
     - Open in a new tab (boolean)

In Visual Studio Create One Runnable Class, In the main method write the below code. If you run it, it’ll open a new tab with the starting page of this blog. For best practice, you create an action menu set its object type to class, and set the object with the runnable class name. Add this menu item to the required menu extension. Save compile On clicking the menu item from navigation. A popup window opens, if your browser pop window is blocked, Allow the popup option. If this code helps you please share it with others.

Post a Comment

0 Comments
Post a Comment
>
To Top