When state/country picklists are enabled, in an apex class can i find whether the state code is related to the country code.
Currently if no check is done.
I'm getting the below error in the visual force page.
Invalid State Code
Invalid state specified for field
Can we handle such type of errors. I have tried by making the below code changes but no use.
Contact myContact = new Contact();
myContact.MailingCountryCode = 'US';
try
{
myContact.MailingStateCode = 'NL';
}catch(Exception e){
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error,'No Relation'));
}
Is there any way to find whether the state code is related to a country code.
Thanks in advance