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
Hamza Akouayri 9Hamza Akouayri 9 

How to assign one picklist value to another picklist list

I have 2 custom picklist both has the same values and under the same object (Case), so  I want whatever its been selected on picklist 1 will be selected in picklist 2  - WF or PB is not the best approaches since I have more than 10 values on the picklist - I am not sure how to approach it using Trigger 

Thanks 
Andrew GAndrew G
part of me wants to know why have the same picklist twice on an object, especially if the values are to be the same.

it could be a simple as:
 
trigger caseTrigger on Case (before insert){

	if (Trigger.isBefore) {
	    for (Case case : Trigger.new) {
                case.secondPicklist__c = case.firstPicklist__c;
	    }
	}
}
as another aside, i would have thought you could use PB with a field reference to do the update, rather than a string.

regards
Andrew

p.s. unless we are talking the dreaded multi-select picklist.
 
SFDC_SaurabhSFDC_Saurabh
I would recommend you using before insert / update trigger for this.
trigger yourTriggername on Account (before insert) {
	for(Case c : Trigger.New) {
        c.Field2 = c.Field1; // your picklist fields
    }  
}