Solved

Open up a CRM 2011 Dialog using a JS button

Posted on 2013-05-20
1
1,327 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

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…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

751 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