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
BrandiTBrandiT 

Help Needed with Apex Class: Multi-Select field not populating

I could use some help with correcting an apex class I have.  The apex class copies values of fields from one object to another.  I have a field called Request_Type2__c that was a picklist field.  I had to convert this over to a multi-select picklist and now the apex class is not working.  The values don't copy over.  How can I rewrite this so that the values copy over?  There are only 3 possibles values for the field: Media Plan; Art; Digital

 

Here is my class (the part in red is the part not working, both fields are Multi-Select with the same possible values):

 

public class OppSaveAttach{
    ApexPages.StandardController controller;
        public OppSaveAttach(ApexPages.StandardController con){
                controller = con;
                     }                                      
public PageReference save()
 {        
 
Opportunity opp = (Opportunity)controller.getRecord();  

  Media_Plan_History__c mp = new Media_Plan_History__c
    (Opportunity__c=Opp.id, states_needed__c=opp.states__c,
    states_included__c=opp.states_included__c,
    Zip_Locations_Attached__c=opp.zip_locations_attached__c,
    city_locations_attached__c=opp.city_locations_attached__c,
    radius__c=opp.radius__c, media_planner__c=opp.media_planner__c,
    comments__c=opp.comments_to_support__c,
    request_type2__c=opp.sh_request_type__c
    );
 insert mp;
  
  if (opp.support_requests__c != null)
  opp.support_requests__c = opp.support_requests__c + 1;

UPDATE OPP;

            controller.save();           
            return page.Opp_Add_Attachments;
}
}

 

 

Thanks in advance!!

Best Answer chosen by Admin (Salesforce Developers) 
Bhawani SharmaBhawani Sharma
Can you check FLS for this field?