/***********Custom setting **********/
Map<string, CountryCO__c> codes = CountryCO__c.getAll();
string pb;
list<string> pb1=new list<string>();
for (string key: codes.keyset())
{
CountryCO__c code = codes.get(key);
pb=code.Country_code__c ;
pb1.add(pb);
}
List<CountryListWrapper> CountryList= new List<CountryListWrapper>();
List<Country__c> countrynew = new List<Country__c> ([Select Countrycode,price,state from Country__c ] ) ; //Custom object
for(Country__c c: countrynew ) {
CountryListWrapper cl = new CountryListWrapper();
cl .Countrycode = c.Country_code__c ;
cl .Prodprice uctCode = c.price__c ;
cl .state = c.state__c ;
CountryList.add(cl );
}
/*******Wrapper class*********/
public class CountryListWrapper{
@AuraEnabled public Integer Countrycode {get;set;}
@AuraEnabled public Integer price {get;set;}
@AuraEnabled public Integer state {get;set;}
}
I have created a custom setting with two fields(Country,Country Code).How to create a map with these two fields,so that I can take key's value and assign it to a wrapper class variable?The variable in wrapper class is assigned to a list containing custom object fields. Of-which one field in custom object is Country Code,which should be assigned with custom settings Country code field value.