Show a break in Dynamics 365 CE alerts – JavaScript

Hi Everyone,

Today I was writing a JavaScript to some alert message to the user. To fulfill my requirement, I have to show two messages in the same box and I have written the code as below.

 var alertStrings = { confirmButtonLabel: "Ok", text: "Line 1\n Line 2", title: "Sample title" };
    var alertOptions = { height: 120, width: 260 };
    Xrm.Navigation.openAlertDialog(alertStrings, alertOptions).then(
        function (success) {
            console.log("Alert dialog closed");
        },
        function (error) {
            console.log(error.message);
        }
    );

Somehow, I felt that the message was not looking good and it would look better if give the space between message and after some search came to know that it works if we write the code as below.

var alertStrings = { confirmButtonLabel: "Ok", text: "Line 1 \n" + decodeURI("%E2%80%8A") + "\nLine 2", title: "Sample title" };
    var alertOptions = { height: 250, width: 260 };
    Xrm.Navigation.openAlertDialog(alertStrings, alertOptions).then(
        function (success) {
            console.log("Alert dialog closed");
        },
        function (error) {
            console.log(error.message);
        }
    );

Hope this helps.


Happy 365íng
Gopinath.

One thought on “Show a break in Dynamics 365 CE alerts – JavaScript

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 )

Google photo

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

Twitter picture

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

Facebook photo

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

Connecting to %s