Solved

Open up a CRM 2011 Dialog using a JS button

Posted on 2013-05-20
1
1,319 Views
Last Modified: 2013-06-19
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
Comment
Question by:newjeep19
1 Comment
 
LVL 27

Accepted Solution

by:
Chinmay Patel earned 500 total points
ID: 39182148
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

On Sep 22nd 2014 Microsoft released Update Rollup 1 for Microsoft Dynamics CRM 2013 Service Pack 1 and back in July Update Rollup 3 was released.  So we now have:   Update Rollup 1Update Rollup 2Update Rollup 3Service Pack 1Update Rollup 1 for S…
Desired Skill Set for Microsoft Dynamics CRM Technical Resources – Part I
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question