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
Lakshmi SLakshmi S 

Update Multiselect picklist field from another multiselect field based on condition ?

Hi Team,

Requirement : We have two multiselect picklist fields called Country and Region.Based on country we need to update the Region.
Ex : Country - If we Select -- India, Ireland, Sweden, In Region we need to update like - MEA,UKI,Nordics.
Note : Both are Multiselect picklist fields and pre defined picklist values.
How can we achieve that.
Please let me know anyone.

Thanks,
Lakshmi.
 
Raj VakatiRaj Vakati
You have to do it with the trigger  refer this sample code  .. can you please check in process builder if you can able to do  it or not 

 
trigger MULTISELCTPICK on Account (before insert, after before){
    for (Account a : Trigger.new)
            List<String> cnts = a.Country.split(';');
			Set<String> uniq = new Set<String>() ; 
			uniq.addAll(cnts) ; 
if(uniq.Contains('India') || ......){
	a.Region__c ='YOURREGION';
}
			
			
		}
}

 
Lakshmi SLakshmi S
Hi Raj Vakati,

Thanks for you reply.
Suppose i have more than 100 countries and 20 regions, How can we achieve that.We need to write if condition for each country?

Thanks,
Lakshmi S.
Raj VakatiRaj Vakati
Create those values in the custom setting and get from there .. 
REgion and it's all coma separated country as one record in custom metadata type