Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1352
  • Last Modified:

Open up a CRM 2011 Dialog using a JS button

I have a button on a CRM 2011 Entity that when clicked it should open a dialog. The issue is that the dialog is not opening. My java script code is below:
function Mscrm_Isv_quote_Form_Group1_Control6_0() {
    OpenLeadConvertDialog();--does not open the function
}


// DISABLE Approve 500k Quote BUTTON -- checks if the fields have the condtions...if so then the button is visable

function ButtonEnable_500kQuote() {
    var _stateCode = Xrm.Page.getAttribute("statecode").getValue();
    var _statuscode = Xrm.Page.getAttribute("statuscode").getValue();
    var _totalamount = Xrm.Page.getAttribute("totalamount").getValue();
    var _approved500k = Xrm.Page.getAttribute("gtri_totalamountapprovedover500").getValue();

    if (_stateCode != 1 || _statuscode == 3 || _totalamount == "undefined" || _totalamount < 500000) {
        return false;
    }
    else {
        if (_approved500k == "undefined" || _approved500k == 0) {
            return true;
        }
        else {
            return false;
        }
    }
}

//FUNCTION Call Dialog-- not working but should be opening or launching the dialog

function OpenLeadConvertDialog() {
    var _serverUrl = Xrm.Page.context.getServerUrl();
    var _dialogId = "ACE96291-2E9B-4B4E-83E5-BD4AAEB5A4F6";
    var DialogURL = _serverUrl + "/cs/dialog/rundialog.aspx?DialogId=%7b" + _dialogId + "7d&EntityName=quote&ObjectId" + Xrm.Page.data.entity.getId();
    var _sOptions = 'dialogWidth:500px; dialogHeight:400px';
    var _returnValue = showModalDialog(DialogURL, null, sOptions);

    if (DialogURL != "") {
        window.open(DialogURL);

    }
}

Open in new window


So, basically when the user clicks on the button (Mscrm_Isv_quote_Form_Group1_Control6_0) that should then call the (OpenLeadConvertDialog) function which builds the url to the dialog box.
Please help.
Thank you
0
newjeep19
Asked:
newjeep19
1 Solution
 
Chinmay PatelEnterprise ArchitectCommented:
Hi newjeep19,

What XML goes into the ribbon. I think you might not have passed right information in XML. Put debugger; (if you know how to debug JavaScript it is fairly simple) or some alerts so that you can be sure that at least the function is being called.

Regards,
Chinmay.
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now