0

I have a requirement where Multiselect picklist field to be controlling field on field dependencies for dependent picklist field but this is not possible.Here is the idea. https://success.salesforce.com/ideaview?id=08730000000BqrfAAC

Any other alternative on Standard page layout without having an inline visualforce page.

0

It is possible only with Visualforce or JS. Although JS may be trouble and I don't recommend this approach.

You may also consider switching to group of checkboxes instead of multipicklist(if possible).

0

I did some similar kind of implementation as below. I used connection.js to get the entire dependent field mapping in VF page and create the multiselect list accordingly throught JS. Hope this helps.

<apex:page showHeader="true" sidebar="true" standardController="Book__c">
    <script type="text/javascript">
        var __sfdcSessionId = '{!GETSESSIONID()}';
    </script>
    <script src="../../soap/ajax/34.0/connection.js" type="text/javascript"></script>
    <script type="text/javascript" src="{!$Resource.multipicklistjs}"/>
    <apex:form id="myForm">
        <apex:selectList id="countries" multiselect="true" size="10" onchange="getListOfCities(this)">
            <apex:selectOption itemValue="select" itemLabel="--Select--"/>
        </apex:selectList>
        <apex:selectList id="cities" multiselect="true" size="10">
            <apex:selectOption itemValue="select" itemLabel="--Select--"/>
        </apex:selectList>
    </apex:form>
    <script type="text/javascript">
        var OBJ_NAME = 'Book__c'; //Custom Object Name
        var CTRL_FIELD_NAME = "Country__c"; //Controlling Picklist
        var DEP_FIELD_NAME = "City__c"; // Dependent Picklist
        var getKeys = function(obj){
           var keys = [];
           for(var key in obj){
              keys.push(key);
           }
           return keys;
        }       
        var jsonList = getDependentOptions(OBJ_NAME, CTRL_FIELD_NAME, DEP_FIELD_NAME); // Get entire JSON array.
        console.debug(jsonList); // It will print something like {USA: Array[2], INDIA: Array[2], Canada: Array[2], China: Array[2], Finland: Array[2]…}    
        var countryOptions = getKeys(jsonList); // Get the Country List from the JSON
        var sel = document.getElementById('{!$Component.myForm.countries}');
        createOptions(countryOptions,sel);//Populate the country List

        function getListOfCities(sel) {
            var cityOptions = jsonList[sel.value];
            var dependentList = document.getElementById('{!$Component.myForm.cities}');
            createOptions(cityOptions,dependentList);//Append to the dependent picklist
        }
        function createOptions(listoptions,sel){
            for(var i = 0; i < listoptions.length; i++) {
                var opt = document.createElement('option');
                opt.innerHTML = listoptions[i];
                opt.value = listoptions[i];
                sel.appendChild(opt);
            }
        }                       
    </script>
</apex:page>

Preview of VF page

enter image description here

Dependent Field Mapping

enter image description here

2
  • Out of curiosity, for Canada the next picklist should show Ontario, Quebec not New York, Chicago twice? Oct 15 '15 at 17:32
  • @VigneshwaranG Good catch. I updated the screenshot above.
    – Saroj Bera
    Oct 16 '15 at 5:18
0

A solution I've used in one case that absolutely called for the abominable fields was by using flow.

You can establish a Parent/Child Multi-select picklist to multi-select picklist relationships using flow screen elements and decision elements.

First Screen 1 has MulSelectPicklist_Main field.

Which is followed by a Decision Element:

IF MulSelectPicklist_Main contains MulselectPicklist_% Show Screen # with MulSelectPicklist_% else route to next decision element. Chain Decisions until end of flow.

%=dependent multi select pick-lists

# =subsequent flow screen elements which display specific multi select pick-lists.

You can add this flow as a subflow in a structured process or add as launch the flow via a button on the page layout.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.