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
Shailendra ShuklaShailendra Shukla 

How do I copy the values present in one Multi-select Picklist to another Multi-select picklist field?

My organization has some products that only the customer uses and some that are only used internally within the organization. Now, since the form for both types of tickets (external and internal) is the same, one product field (Multi-select Picklist) has all the products in it. But I cannot put this field on the Self-Service portal as I do not want my customers to see the tools that we use internally. Also, I cannot divide the page into external or internal. My only option here is to create a new Multi-select Picklist field with only the external products and put that field on the self service portal. What I want to achieve is that the value from the field in the SSP should be replicated on the product field with all the products.

So, How do I copy the values present in one Multi-select Picklist to another Multi-select Picklist field?

I think maybe an apex code could be of use here.

Any help in the matter would be appreciated.
Tugce SirinTugce Sirin
You can write a trigger as before insert and before update and check if external-products-multiselect-picklist and all-products-multiselect-picklist has same values or not and update the field accordingly.

An example code would look like this;
trigger updateField on Object__c(before insert, before update){
  List<Object__c> objects =;
  for(Object__c o: objects){
    if(Object__c.External__c != null && Object__c.External__c != Object__c.All__c){
      Object__c.All__c = Object__c.External__c;

Shailendra ShuklaShailendra Shukla
The code that worked to some extent was:
trigger IncidentTrigger on BMCServiceDesk__Incident__c (before insert) {
    List<BMCServiceDesk__Incident__c> incident =;
    for(BMCServiceDesk__Incident__c inci : incident){
        if(inci.Product_SSP__c!=null && inci.Product_SSP__c!= inci.Product__c){
            inci.Product__c = inci.Product_SSP__c;

However, this works one way. is there a way to sync both the fields so that a change in either of the fields reflects in the other?