function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jagadeesh AdaveniJagadeesh Adaveni 

Can you please help me out?

Hi All,

I have Location and student objects are there. In Location object multiselect picklist paymentmode is there with values(ACH,Check,Cash) and student is lookup to location and even in Student i have picklist called paymentmode with values(ACH,Check,Cash).
 Requirement is Whatever the values i selected in Location only those values should appear in student. I tried following code but it is not working
VisualforcePage
----------------------
<apex:inputField value="{!Student__c.Payment_Mode__c}">
                  <apex:actionSupport event="onchange" action="{!picklistFunction}"/>
              </apex:inputField>
              
Controller
--------------

    public PageReference picklistFunction()
    {
        List<Student__c> studentList = new List<Student__c>();
        List<Student__c> stuList = [select id,name,Payment_mode__c,Location__c,Location__r.Payment_mode__c from Student__c];
        for(Student__c st : stuList)
        {
            st.payment_mode__c = st.Location__r.Payment_Mode__c;
            studentList.add(st);
        }
        
           update studentList;
        return null;
    }


 
praveen murugesanpraveen murugesan
Hi jagadeesh,

In student obj u can create one formula field in that store "Location__r.Payment_mode__c" its a simple solution.

Mark its as best answer if its helps.

Thanks.
Jagadeesh AdaveniJagadeesh Adaveni
Hi Praveen,

It is giving error saying that  Error: Field Payment_mode__c is a multi-select picklist field. Multi-select picklist fields are only supported in certain functions.