cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Getting country code from country name

Former Member
0 Kudos
636

Hello Experts,

Is there an OOTB service provided that I could use it to get the country code from the country's name?

For example, Great Britain -> GB

I have searched for the following service a lot however I always end up with the getIsoCode method for the currency.

Your help is highly appreciated!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Unfortunately We do not have any service Out of box to get country code from country name. You have to write your own.

Former Member
0 Kudos

Ok, thanks alot!

Answers (1)

Answers (1)

radek_michalczyk
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

just a comment.

Maybe you have special / rare usecase, but generally it doesn't sound good to get isocode for String that is name of country. What if there is an misspelling in name of country? Take for example US, people can do it like that:

US

USA

United States of America

etc.

If this is not about human giving the value then better is to pass isocode everywhere and then translate to name when display. Also country name is not unique, can be empty (yes, it would be then data issue).