navigateTo (Client API reference)

Navigates to the specified page.

Note

This method is supported only on the Unified Interface.

Syntax

Xrm.Navigation.navigateTo(pageInput,navigationOptions).then(successCallback,errorCallback);

Parameters

Name Type Required Description
pageInput Object Yes

Input about the page to navigate to. The object definition changes depending on the type of page to navigate to: entity list or HTML web resource.

entity list

The object contains the following attributes:

  • pageType: String. Specify "entitylist".
  • entityName: String. The logical name of the entity to load in the list control.
  • viewId: (Optional) String. The ID of the view to load. If you don't specify it, navigates to the default main view for the entity.
  • viewType: (Optional) String. Type of view to load. Specify "savedquery" or "userquery".

HTML web resource

The object contains the following attributes:

  • pageType: String. Specify "webresource".
  • webresourceName: String. The name of the web resource to load.
  • data: (Optional) String. The data to pass to the web resource.
navigationOptions Object No

Options for navigating to a page: whether to open inline or in a dialog. If you don't specify this parameter, page is opened inline by default. The object contains the following attributes:

  • target: Number. Specify 1 to open the page inline; 2 to open the page in a dialog.
    Entity lists can only be opened inline; web resources can be opened either inline or in a dialog.
  • width: (Optional) Number or Object. The width of dialog. To specify the width in pixels, just type a numeric value. To specify the width in percentage, specify an object of type SizeValue with the following properties:
    • value: Number. The numerical value.
    • unit: String. The unit of measurement. Specify "%" or "px". Default value is "px".
  • height: (Optional) Number or Object. The height of dialog. To specify the height in pixels, just type a numeric value. To specify the width in percentage, specify an object of type SizeValue with the following properties:
    • value: Number. The numerical value.
    • unit: String. The unit of measurement. Specify "%" or "px". Default value is "px".
  • position: (Optional) Number. Specify 1 to open the dialog in center; 2 to open the dialog on the side. Default is 1 (center).
successCallback function No

A function to execute on successful navigation to the page when navigating inline and on closing the dialog when navigating to a dialog.

errorCallback Function No

A function to execute when the operation fails.

Example

The following example demonstrates how to navigate to an HTML web resource that is opened in a dialog:

var pageInput = {
    pageType: "webresource", 
    webresourceName: "new_sample_webresource"
};
var navigationOptions = {
    target: 2,
    width: 400,
    height: 300,
    position: 1
};
Xrm.Navigation.navigateTo(pageInput, navigationOptions).then(
    function success() {
            // Handle dialog closed
    },
    function error() {
            // Handle errors
    }
);

Xrm.Navigation