Dynamics 365 – Opening a Custom Page by Xrm.Navigation.navigateTo

Each of the following client API examples takes the logical name of the custom page as the required parameter. The logical name is the Name value of the page in the solution explorer.

Open the custom page as an inline full page without context

// Inline Page
var pageInput = {
    pageType: "custom",
    name: "cr8f7_mycustompage_93eb7",
};
var navigationOptions = {
    target: 1
};
Xrm.Navigation.navigateTo(pageInput, navigationOptions)
    .then(
        function () {
            // Executed when page opens
        }
    ).catch(
        function (error) {
            // Handle error
        }
    );

Open the custom page as an inline full page with a record context

  • recordId: Id of the record to use
// Inline Page
var pageInput = {
    pageType: "custom",
    name: "cr8f7_mycustompage_93eb7",
    entityName: "account",
    recordId: "2d763a2a-f07b-eb11-a812-000d3adc839f",
};
var navigationOptions = {
    target: 1
};
Xrm.Navigation.navigateTo(pageInput, navigationOptions)
    .then(
        function () {
            // Executed when page opens
        }
    ).catch(
        function (error) {
            // Handle error
        }
    );

Open the custom page as a centered dialog

// Centered Dialog
var pageInput = {
    pageType: "custom",
    name: "cr8f7_mycustompage_93eb7",
};
var navigationOptions = {
    target: 2, 
    position: 1,
    width: {value: 50, unit:"%"},
    title: "My Custom Page"
};
Xrm.Navigation.navigateTo(pageInput, navigationOptions)
    .then(
        function () {
            // Executed when the dialog closes
        }
    ).catch(
        function (error) {
            // Handle error
        }
    );

Open as a side dialog

// Side Dialog
var pageInput = {
    pageType: "custom",
    name: "cr8f7_mycustompage_93eb7",
};
var navigationOptions = {
    target: 2, 
    position: 2,
    width: {value: 500, unit: "px"},
    title: "My Custom Page"
};
Xrm.Navigation.navigateTo(pageInput, navigationOptions)
    .then(
        function () {
            // Executed when the dialog closes
        }
    ).catch(
        function (error) {
            // Handle error
        }
    );
Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s