Class Browser For Navigation To URL

With the new Dynamics AX there are new APIs that are needed because of the technological changes. 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.

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

  • URL (string)
  • Open in new tab (boolean)
  • Prompt (boolean)

I think all of them are self-explaining.

A simple example using a runnable class could look like the following. If you run it, it’ll open a new tab with the starting page of this blog.

class xltyBrowserExample
{        
    /// <summary>
    ///     Runs the class with the specified arguments.
    /// </summary>
    /// <param name = "_args">The specified arguments.</param>
    public static void main(Args _args)
    {
        Browser browser = new Browser();
        browser.navigate('https://axility.NET/', true, false);
    }
}

xltyBrowserExample

2 thoughts on “Class Browser For Navigation To URL

  1. Hi,

    I have created new class and put this code there. Then Created an output menu and set the object type to class and set the object name to class name. but i am getting the following error

    Severity Code Description Project File Line Suppression State
    Error Path: [AxMenuItemOutput/BL_ReportingServices/Object]:Invalid method signature on class ‘AX_ReportingServices’. Expected signature: ‘public static [returnType] main(xArgs _args, […])’. AX_MH_170707_CashListing_Extensions (VAR) [Quantiq] J:\AosService\PackagesLocalDirectory\Quantiq\Quantiq\AxMenuItemOutput\BL_ReportingServices.xml 0

    • Don’t you need to use an action menu item when you want to use a runnable class (one with a static main method)? I used output menu items for direct references of reports only in the past – though only a few times…

Leave a Comment