Solved

Open up a CRM 2011 Dialog using a JS button

Posted on 2013-05-20
1
1,308 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Automatically creating a Trello card using data from a Microsoft Dynamics CRM record turned out to be an easy project that yielded great results.  Here's how I did this for an internal team at General Code.
For cloud, the “train has left the station” and in the Microsoft ERP & CRM world, that means the next generation of enterprise software from Microsoft is here: Dynamics 365 is Microsoft’s new integrated business solution that unifies CRM and ERP fun…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now