Currently we have a trigger on Account object which updates one field based on certain conditions and if that field value matches with another object where all the values are mentioned. One of the conditions we are also checking on running user's country field like this
if (usrcountry == 'Australia' || usrcountry == 'New Zealand' || usrcountry == 'Austria' || usrcountry == 'Belgium' )
{
Logic
}
As there are more no. of countries coming to use this part, I need to create a custom settings instead of hard coding country value always in this condition.
I have created a hierarchical custom settings let's say test and filled country values like this Australia, New Zealand, Germany by holding them in a custom field under custom settings which are comma separated. However, I am unsure how to use this in if condition of the trigger which I mentioned here – if (usrcountry == 'Australia' || usrcountry == 'New Zealand' || usrcountry == 'Austria' || usrcountry == 'Belgium' )
Best Answer
See the code sample below for how to use a comma separated list that is stored in a custom setting.
Null checks are excluded from this sample. You would need to add them where needed.