MSCRM Javascript confirm box - New feature in MSCRM 2015

Say good bye to normal java script confirm box. Microsoft Provided a new confirm box in new version 2015.

Syntax:

 Xrm.Utility.confirmDialog(message, yesCloseCallback, noCloseCallback)

How to use it:
1. Call "GetCurrentStageName" function on Opportunity form load event.

function GetCurrentStageName() {
    var formType = Xrm.Page.ui.getFormType();
    if (formType == 2 || formType == 3 || formType == 4) {
        var activeStage = Xrm.Page.data.process.getActiveStage();
        var stageName = activeStage.getName();
        Xrm.Utility.alertDialog(stageName, onCloseCallback)
    }
}
function onCloseCallback() {
    var message = "This is javascript confirm box";
    Xrm.Utility.confirmDialog(message, yesCloseCallback, noCloseCallback)
}
function yesCloseCallback() {
    Xrm.Utility.alertDialog("you clicked on Yes");
}
function noCloseCallback() {
    Xrm.Utility.alertDialog("you clicked on No");
}

Applies To: CRM 2015 on-prem, CRM Online

Comments

Popular posts from this blog

Connecting Dynamics 365 Web api using external HTML page

Get azure blob files inside Sub Directories

Interview questions on MS CRM