Hello Leah,
I managed to make it work. getText() did not work, but I created a hardcoded list of country codenames mapped to an array of the Country name and Country Index based on how they are in the global choice like below:
var countryCodeNames = {
'FRA' : ["France", 24],
'AUS': ["Australia, 26],
...
}
Then I use getValue() to get the codename of the selected result, and using the object above, I set its country index as the value of my other field. I know it's hardcoded, but it works and I don't think anyone will be changing country names soon :P