Single post - 1

Alert, confirmation, error pop-up in Dynamics 365(V9.0)


While working with latest version of CRM (Dynamics 365 v9.0) found some excited features such as dialog alerts using client side navigation. Dynamics 365 v9.0 has introduced Xrm.Navigation namespace under Xrm object. It has a mix of new methods and old methods moved from Xrm.Utility.

Previously we had Xrm.Utility.alertDialog which did not have that much features and in Web Client showed as the plain old alert, which was the same as from standard JavaScript “alert” function. Right now the alert is much better on look and feel.

New methods which we can use are the following:

Let’s look one by one on each of them with the help of example.

1. Xrm.Navigation.openConfirmDialog

var ConfirmString =
text: “Are you sure want to Approve?”,
title: “Confirmation Alert”,
subtitle: ” This Account is Requested to Delete”,
confirmButtonLabel: “Approve”,
cancelButtonLabel: “Cancel”
var OptionalParameter = { height: 200, width: 400 };
Xrm.Navigation.openConfirmDialog(ConfirmString, OptionalParameter).then(
function (success)
function (error)
var ErrorDetails = error.message;
Xrm.Navigation.openAlertDialog({ text: ErrorDetails });


2. Xrm.Navigation.openAlertDialog:

var alertStrings =
confirmButtonLabel: “Okay”,
text: “Please fill up Rejection Remarks for Request to delete”
function () { console.log(“Dialog was closed”); },
function () { console.log(“Something went wrong”); });


3. openFile

var file =
fileContent: “bXkgc2VjcmV0IGNvbnRlbnQ=”, //Contents of the file.
fileName: “DownloadFileSample.txt”, //Name of the file.
fileSize: 24, //Size of the file in KB.
mimeType: “text/plain” //MIME type of the file.
Xrm.Navigation.openFile(file, 2);

download file

4. openErrorDialog

var errorOptions =
details: “Click on Download Log File to download error log file. ‘Download Error log file’”,
errorCode: 666, //this is error code if you want to show some specific one. If you specify invalid code or none, the default error
code wouldbe displayed
message: “Message show in the dialog”
success => {console.log(“Dialog was closed successfully”);},
error => {console.log(error);});

error log file

5. openUrl

var url = “”;
var openUrlOptions = {
height: 500,
width: 900
Xrm.Navigation.openUrl(url, openUrlOptions);

open url

6. openForm

var entityFormDetails = {
entityName: “contact”,
useQuickCreateForm: false
var newFormParameters = {
fullname: “Contact example”,
jobtitle: “Manager”,
emailaddress1: “”,
telephone1: “7658423692”,
description: “Using this function we can auto populate values on new form”
Xrm.Navigation.openForm(entityFormDetails, newFormParameters).then(
success => { console.log(success); },
error => { console.log(error); });


7. openWebResource

var windowPopupOptions = {
openInNewWindow: false,
height: 500,
width: 500
Xrm.Navigation.openWebResource(“new_testhtmlpage”, windowPopupOptions, “someAdditionalParameter”);
Sample HTML code:
Hi this is test HTML page


Be ready for new features and enjoy this feature of dynamics 365 v9.0
Hope this help you !!!
Thank you.

Pravin Pawar
NSquare Xperts