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.