+ Start a Discussion
Brian KimBrian Kim 

Dependent multi-select picklist not displaying chosen values when its page is calling from other page

Hi,
 
It seems that this is a known issue (https://success.salesforce.com/issues_view?id=a1p30000000T2KyAAK) but I am looking for some alternative solutions or workaround for this.

Here is the description of the issue and sample codes.
  • Custom Fields in Account Object
There are two custom picklists in Account object. Pick_1__c is a controlling field and Pick_2__c is a dependent field and Pick_2__c is multi-select picklist.
  • VisualForce Page
Page 1: it has a button called “Go To Page2” and it opens Page2 when clicking.
Page 2: you can save the Pick 1 and Pick 2 values in this page and it opens Pick 2  page after saving.
  • Issue Description
When opening Page 2 after saving the picklist values the values chosen for Pick_2__c are not listed in Chosen section. (All are listed in Available section as shown in below picture)
User-added image
If the Page 2 is directly called from the web browser like https://yoursite.visual.force.com/apex/page2, it is correctly listing the chosen values as shown in below picture.

User-added image
  • Sample Source
You need to create below two picklists in Account object.
Pick_1__c: PickList (controlling)
Pick_2__c: (multi-select) PickList (Dependent)

VisualForce Page - Page1
<apex:page controller="myController"  cache="false"> 
    <apex:form >
       <apex:pageBlock >
           <apex:pageBlockButtons > 
              <apex:commandButton value="Go To Page2" action="{!gotoPage2}"/>
          </apex:pageBlockButtons>          
       </apex:pageBlock>  
    </apex:form> 
</apex:page>



​VisualForce Page - Page2
 
<apex:page controller="myController"  cache="false"> 
    <apex:form >      
        <apex:pageBlock title="Select Pick List" mode="edit" id="thePageBlock"> 
           <apex:pageBlockButtons > 
              <apex:commandButton value="Save" action="{!save}"/>
          </apex:pageBlockButtons>       
            <apex:pageBlockSection columns="1" id="multiselectsection">
                <apex:inputField value="{!Acc.Pick_1__c}" required="true"  id="pick1"/>
                <apex:inputField value="{!Acc.Pick_2__c}" required="true"  id="pick2"/>
           </apex:pageBlockSection> 
        </apex:pageBlock>  
    </apex:form> 
</apex:page>


Controller – myController
 
public class myController {

    public Account Acc {get;set;}
    
    public myController() {         
        String ssid = '\'001f4000004zngp\'';
        String q = 'select Pick_1__c, Pick_2__c from Account where id = ' + ssid;
        Acc = Database.query(q);       
    }
    public pageReference save() {       
        Update Acc;
        return page.Page1; 
    }
    public pageReference gotoPage2() {
        return page.Page2;
    }
}


Thank you so much for your time.
Brian Kim 
brian.kim@suppliersoft.com
NagendraNagendra (Salesforce Developers) 
Hi Bryan,

Sorry for this issue you are encountering.

I tried the same in my test ORG with two dependent picklists with the dependent one being multi select and am able to get the selected values under the chosen section of the picklist when I go to edit it.

Please refer the below screenshot for your reference:
User-added image

Thanks,
Nagendra
 
Brian KimBrian Kim
Hi Nagendra,
Thank you for your reply.

I think I haven't mentioned some conditions of the example.  
Even in my example, if the conroller is refreshed by redirecting to the page 2 it shows the chosen values in the dependent pick-list. 
Here is additional conditions: 
  • The two pages have to associated with the same controller (myController in my example)
  • And the Page 2 in my example should be called without redirecting to it. In other words, we should not refresh the controller since we need to keep the view states.
  • ddd
Please let me know if you have any questions or have any progress.
Thank you so much.
Brian Kim
hari.phari.p
Did you figured out any workaround for this issue. I am also facing the same issue with dependent multiselect picklist. Please let me know if you have any solution in place.