locked
Dependent dropdown in CRM 2011? RRS feed

  • Question

  • Hi

    How to create dependenct dropdowns in CRM 2011?


    If you find this post helpful then please "Vote as Helpful" and "Mark As Answer". Thanks and Regards, Yogesh Vijay Mulay

    Tuesday, March 19, 2013 9:19 AM

Answers

  • Hi,

    Please go through the following links which will be helpful to you,

    http://blogs.msdn.com/b/paf/archive/2011/04/21/how-to-easily-create-dependent-picklist-in-crm-2011.aspx

    http://www.madronasg.com/blog/dependent-option-sets-crm-2011#.UUgtihdHJRY

    http://treeviewfordependent.codeplex.com/

    http://sliong.wordpress.com/2012/05/16/crm-2011-dependent-picklist-optionset/

    http://guruprasadcrm.blogspot.in/2010/11/dependent-picklist-issue-in-crm-2011.html

    http://myencounterwithcrm.wordpress.com/category/crm-2011/dependent-picklist/

    It is not drop down it is picklist (option set in crm 2011)


    Thanks & Regards, MS CRM Consultant, V.Surya. My Blog: http://inventcrm.wordpress.com/

    Tuesday, March 19, 2013 9:22 AM
    Answerer
  • Hi,

    Here is a sample which I use:

    function OnLoad() {
        var optionsetControl = Xrm.Page.ui.controls.get("brd_statusreason");
        var options = optionsetControl.getAttribute().getOptions();
        var type = Xrm.Page.getAttribute("brd_status").getValue();
        var reason = Xrm.Page.getAttribute("brd_statusreason").getValue();
            // 'Active' is selected
            if (type == 172100000) {
                optionsetControl.clearOptions(); 
                for (var i = 0; i < options.length - 1; i++) {
                    if (i == 0 || i == 1 || i == 2) {
                        optionsetControl.addOption(options[i]);
                    }
                }
            }
            // 'Resolved' is selected
            else if (type == 172100001) {
                optionsetControl.clearOptions();
                for (var i = 0; i < options.length - 1; i++) {
                    if (i == 3 || i == 4) {
                        optionsetControl.addOption(options[i]);
                    }
    
                }
            }
            // 'Cancelled' is selected
            else if (type == 172100002) {
                optionsetControl.clearOptions();
                optionsetControl.addOption(options[5]);
            }
    Xrm.Page.getAttribute("brd_statusreason").setValue(reason);
     }
    

    Remember that you have to set separate functions for onload and onchage events. For the onload you have to save the value of the field to set it at the end of the function (as in above sample). For onchange it is not needed to save the field value and set it at the end.


    If the answer helped you, remember to mark it as answer.

    Tuesday, March 19, 2013 9:37 AM
    Moderator

All replies

  • Hi,

    Please go through the following links which will be helpful to you,

    http://blogs.msdn.com/b/paf/archive/2011/04/21/how-to-easily-create-dependent-picklist-in-crm-2011.aspx

    http://www.madronasg.com/blog/dependent-option-sets-crm-2011#.UUgtihdHJRY

    http://treeviewfordependent.codeplex.com/

    http://sliong.wordpress.com/2012/05/16/crm-2011-dependent-picklist-optionset/

    http://guruprasadcrm.blogspot.in/2010/11/dependent-picklist-issue-in-crm-2011.html

    http://myencounterwithcrm.wordpress.com/category/crm-2011/dependent-picklist/

    It is not drop down it is picklist (option set in crm 2011)


    Thanks & Regards, MS CRM Consultant, V.Surya. My Blog: http://inventcrm.wordpress.com/

    Tuesday, March 19, 2013 9:22 AM
    Answerer
  • Hi,

    Here is a sample which I use:

    function OnLoad() {
        var optionsetControl = Xrm.Page.ui.controls.get("brd_statusreason");
        var options = optionsetControl.getAttribute().getOptions();
        var type = Xrm.Page.getAttribute("brd_status").getValue();
        var reason = Xrm.Page.getAttribute("brd_statusreason").getValue();
            // 'Active' is selected
            if (type == 172100000) {
                optionsetControl.clearOptions(); 
                for (var i = 0; i < options.length - 1; i++) {
                    if (i == 0 || i == 1 || i == 2) {
                        optionsetControl.addOption(options[i]);
                    }
                }
            }
            // 'Resolved' is selected
            else if (type == 172100001) {
                optionsetControl.clearOptions();
                for (var i = 0; i < options.length - 1; i++) {
                    if (i == 3 || i == 4) {
                        optionsetControl.addOption(options[i]);
                    }
    
                }
            }
            // 'Cancelled' is selected
            else if (type == 172100002) {
                optionsetControl.clearOptions();
                optionsetControl.addOption(options[5]);
            }
    Xrm.Page.getAttribute("brd_statusreason").setValue(reason);
     }
    

    Remember that you have to set separate functions for onload and onchage events. For the onload you have to save the value of the field to set it at the end of the function (as in above sample). For onchange it is not needed to save the field value and set it at the end.


    If the answer helped you, remember to mark it as answer.

    Tuesday, March 19, 2013 9:37 AM
    Moderator