• Brian Kim
  • NEWBIE
  • 0 Points
  • Member since 2017
  • Manager
  • SupplierSoft, Inc

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
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
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