title: Salesforce Apex Trigger data copy from one field to other
body: <p>This is my Apex Trigger in which I am taking data from Custom Field &quot;Picklist Multiple&quot; named(Opportunity_Picklist__c) in Opportunity and automatically paste it to a custom field &quot;text&quot; in Account. Now every selected option from Custom Field &quot;Picklist Multiple&quot; is coming to the custom field &quot;text&quot;. I want to copy only Custom Field &quot;Picklist Multiple&quot; values with API Name &quot;Premium&quot; and &quot;Basic&quot;. Other selected values can be avoided. Please look into the code below and suggest me relatable changes.</p>
  <p>Custom Field &quot;Picklist Multiple&quot; have these data:-</p>
  <ol>
  <li>Premium</li>
  <li>Advanced</li>
  <li>Basic</li>
  <li>Free</li>
  </ol>
  <p>If someone selected all four values in Custom Field &quot;Picklist Multiple&quot; they can remain as it is but I don't want all of them to be copied in custom field &quot;text&quot;. I want the values with API Names &quot;Premium&quot; and &quot;Basic&quot; only in the custom field &quot;text&quot;.</p>
  <pre><code>    trigger OppTrigger on Opportunity (After insert,After update,After delete) {
   if((Trigger.isInsert|| Trigger.isupdate|| Trigger.isDelete) &amp;&amp; Trigger.isAfter)
      {
          Set&lt;Id&gt; acctSet = new Set&lt;Id&gt;();
          List&lt;Account&gt; accList = new List&lt;Account&gt;();
          for(Opportunity opp : Trigger.new)
          {
              acctSet.add(opp.AccountId);
          }
  
          Map&lt;Id, Account&gt; mapAccounts = new Map&lt;Id, Account&gt;([SELECT Id, Plan__c FROM Account where Id IN :acctSet]);
          for(Opportunity opp : Trigger.new)
          {
              Account acc = mapAccounts.get(opp.AccountId);
              If(Trigger.IsDelete){
                  acc.Plan__c = null;
              }
              if(Trigger.isInsert|| Trigger.isupdate){
              acc.Plan__c = opp.Opportunity_Picklist__c;
              }
              accList.add(acc);
          }
          Update accList;
      }
  }
  </code></pre>