DESCRIPTION
When using Quick Connect or the Active Roles Synchronization Service to sync from your HR environment with your Active Roles environment, it does not properly set the country code. It sets the country name, but not the "code". To have a fully functioning environment, you need both. This script sets the second one when the first one is changed. You must call it as part of a policy script.
Note This code may use functions from the Active Roles Script Policy Best Practices. Please, follow the link to obtain instructions and code for those functions.
SCRIPT
'*********************************************************************************
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
' EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
' WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
' IF YOU WANT THIS FUNCTIONALITY TO BE CONDITIONALLY SUPPORTED,
' PLEASE CONTACT ONE IDENTITY PROFESSIONAL SERVICES.
'*********************************************************************************
'Function to set correct country code
Function setcountry(country,objUser)
Select Case country
Case "Afghanistan" objUser.put "c" , "AF"
Case "Åland Islands" objUser.put "c" , "AX"
Case "Albania" objUser.put "c" , "AL"
Case "Algeria" objUser.put "c" , "DZ"
Case "American Samoa" objUser.put "c" , "AS"
Case "Andorra" objUser.put "c" , "AD"
Case "Angola" objUser.put "c" , "AO"
Case "Anguilla" objUser.put "c" , "AI"
Case "Antarctica" objUser.put "c" , "AQ"
Case "Antigua and Barbuda" objUser.put "c" , "AG"
Case "Argentina" objUser.put "c" , "AR"
Case "Armenia" objUser.put "c" , "AM"
Case "Aruba" objUser.put "c" , "AW"
Case "Australia" objUser.put "c" , "AU"
Case "Austria" objUser.put "c" , "AT"
Case "Azerbaijan" objUser.put "c" , "AZ"
Case "Bahamas" objUser.put "c" , "BS"
Case "Bahrain" objUser.put "c" , "BH"
Case "Bangladesh" objUser.put "c" , "BD"
Case "Barbados" objUser.put "c" , "BB"
Case "Belarus" objUser.put "c" , "BY"
Case "Belgium" objUser.put "c" , "BE"
Case "Belize" objUser.put "c" , "BZ"
Case "Benin" objUser.put "c" , "BJ"
Case "Bermuda" objUser.put "c" , "BM"
Case "Bhutan" objUser.put "c" , "BT"
Case "Bolivia" objUser.put "c" , "BO"
Case "Bosnia and Herzegovina" objUser.put "c" , "BA"
Case "Botswana" objUser.put "c" , "BW"
Case "Bouvet Island" objUser.put "c" , "BV"
Case "Brazil" objUser.put "c" , "BR"
Case "British Indian Ocean Territory" objUser.put "c" , "IO"
Case "Brunei Darussalam" objUser.put "c" , "BN"
Case "Bulgaria" objUser.put "c" , "BG"
Case "Burkina Faso" objUser.put "c" , "BF"
Case "Burundi" objUser.put "c" , "BI"
Case "Cambodia" objUser.put "c" , "KH"
Case "Cameroon" objUser.put "c" , "CM"
Case "Canada" objUser.put "c" , "CA"
Case "Cape Verde" objUser.put "c" , "CV"
Case "Cayman Islands" objUser.put "c" , "KY"
Case "Central African Republic" objUser.put "c" , "CF"
Case "Chad" objUser.put "c" , "TD"
Case "Chile" objUser.put "c" , "CL"
Case "China, People's Republic of" objUser.put "c" , "CN"
Case "China" objUser.put "c" , "CN"
Case "Christmas Island" objUser.put "c" , "CX"
Case "Cocos (Keeling) Islands" objUser.put "c" , "CC"
Case "Colombia" objUser.put "c" , "CO"
Case "Comoros" objUser.put "c" , "KM"
Case "Congo, Republic of the" objUser.put "c" , "CG"
Case "Congo, The Democratic Republic Of The" objUser.put "c" , "CD"
Case "Cook Islands" objUser.put "c" , "CK"
Case "Costa Rica" objUser.put "c" , "CR"
Case "Côte d'Ivoire" objUser.put "c" , "CI"
Case "Croatia" objUser.put "c" , "HR"
Case "Cuba" objUser.put "c" , "CU"
Case "Cyprus" objUser.put "c" , "CY"
Case "Czech Republic" objUser.put "c" , "CZ"
Case "Denmark" objUser.put "c" , "DK"
Case "Djibouti" objUser.put "c" , "DJ"
Case "Dominica" objUser.put "c" , "DM"
Case "Dominican Republic" objUser.put "c" , "DO"
Case "Ecuador" objUser.put "c" , "EC"
Case "Egypt" objUser.put "c" , "EG"
Case "El Salvador" objUser.put "c" , "SV"
Case "Equatorial Guinea" objUser.put "c" , "GQ"
Case "Eritrea" objUser.put "c" , "ER"
Case "Estonia" objUser.put "c" , "EE"
Case "Ethiopia" objUser.put "c" , "ET"
Case "European Union" objUser.put "c" , "EU"
Case "Falkland Islands" objUser.put "c" , "FK"
Case "Faroe Islands" objUser.put "c" , "FO"
Case "Fiji" objUser.put "c" , "FJ"
Case "Finland" objUser.put "c" , "FI"
Case "France" objUser.put "c" , "FR"
Case "French Guiana" objUser.put "c" , "GF"
Case "French Polynesia" objUser.put "c" , "PF"
Case "French Southern Territories" objUser.put "c" , "TF"
Case "Gabon" objUser.put "c" , "GA"
Case "Gambia" objUser.put "c" , "GM"
Case "Georgia" objUser.put "c" , "GE"
Case "Germany" objUser.put "c" , "DE"
Case "Ghana" objUser.put "c" , "GH"
Case "Gibraltar" objUser.put "c" , "GI"
Case "Greece" objUser.put "c" , "GR"
Case "Greenland" objUser.put "c" , "GL"
Case "Grenada" objUser.put "c" , "GD"
Case "Guadeloupe" objUser.put "c" , "GP"
Case "Guam" objUser.put "c" , "GU"
Case "Guatemala" objUser.put "c" , "GT"
Case "Guinea" objUser.put "c" , "GN"
Case "Guinea-Bissau" objUser.put "c" , "GW"
Case "Guyana" objUser.put "c" , "GY"
Case "Haiti" objUser.put "c" , "HT"
Case "Heard Island and McDonald Islands" objUser.put "c" , "HM"
Case "Honduras" objUser.put "c" , "HN"
Case "Hong Kong" objUser.put "c" , "HK"
Case "Hungary" objUser.put "c" , "HU"
Case "Iceland" objUser.put "c" , "IS"
Case "India" objUser.put "c" , "IN"
Case "Indonesia" objUser.put "c" , "ID"
Case "Iran, Islamic Republic of" objUser.put "c" , "IR"
Case "Iraq" objUser.put "c" , "IQ"
Case "Ireland" objUser.put "c" , "IE"
Case "Israel" objUser.put "c" , "IL"
Case "Italy" objUser.put "c" , "IT"
Case "Jamaica" objUser.put "c" , "JM"
Case "Japan" objUser.put "c" , "JP"
Case "Jordan" objUser.put "c" , "JO"
Case "Kazakhstan" objUser.put "c" , "KZ"
Case "Kenya" objUser.put "c" , "KE"
Case "Kiribati" objUser.put "c" , "KI"
Case "Korea, Democratic People's Republic of" objUser.put "c" , "KP"
Case "Korea, Republic of" objUser.put "c" , "KR"
Case "Korea" objUser.put "c" , "KR"
Case "Kuwait" objUser.put "c" , "KW"
Case "Kyrgyzstan" objUser.put "c" , "KG"
Case "Lao People's Democratic Republic" objUser.put "c" , "LA"
Case "Latvia" objUser.put "c" , "LV"
Case "Lebanon" objUser.put "c" , "LB"
Case "Lesotho" objUser.put "c" , "LS"
Case "Liberia" objUser.put "c" , "LR"
Case "Libyan Arab Jamahiriya" objUser.put "c" , "LY"
Case "Liechtenstein" objUser.put "c" , "LI"
Case "Lithuania" objUser.put "c" , "LT"
Case "Luxembourg" objUser.put "c" , "LU"
Case "Macao" objUser.put "c" , "MO"
Case "Macedonia, The Former Yugoslav Republic of" objUser.put "c" , "MK"
Case "Madagascar" objUser.put "c" , "MG"
Case "Malawi" objUser.put "c" , "MW"
Case "Malaysia" objUser.put "c" , "MY"
Case "Maldives" objUser.put "c" , "MV"
Case "Mali" objUser.put "c" , "ML"
Case "Malta" objUser.put "c" , "MT"
Case "Marshall Islands" objUser.put "c" , "MH"
Case "Martinique" objUser.put "c" , "MQ"
Case "Mauritania" objUser.put "c" , "MR"
Case "Mauritius" objUser.put "c" , "MU"
Case "Mayotte" objUser.put "c" , "YT"
Case "Mexico" objUser.put "c" , "MX"
Case "Micronesia, Federated States of" objUser.put "c" , "FM"
Case "Moldova, Republic of" objUser.put "c" , "MD"
Case "Monaco" objUser.put "c" , "MC"
Case "Mongolia" objUser.put "c" , "MN"
Case "Montserrat" objUser.put "c" , "MS"
Case "Morocco" objUser.put "c" , "MA"
Case "Mozambique" objUser.put "c" , "MZ"
Case "Myanmar" objUser.put "c" , "MM"
Case "Namibia" objUser.put "c" , "NA"
Case "Nauru" objUser.put "c" , "NR"
Case "Nepal" objUser.put "c" , "NP"
Case "Netherlands" objUser.put "c" , "NL"
Case "Netherlands Antilles" objUser.put "c" , "AN"
Case "New Caledonia" objUser.put "c" , "NC"
Case "New Zealand" objUser.put "c" , "NZ"
Case "Nicaragua" objUser.put "c" , "NI"
Case "Niger" objUser.put "c" , "NE"
Case "Nigeria" objUser.put "c" , "NG"
Case "Niue" objUser.put "c" , "NU"
Case "Norfolk Island" objUser.put "c" , "NF"
Case "Northern Mariana Islands" objUser.put "c" , "MP"
Case "Norway" objUser.put "c" , "NO"
Case "Oman" objUser.put "c" , "OM"
Case "Pakistan" objUser.put "c" , "PK"
Case "Palau" objUser.put "c" , "PW"
Case "Palestinian Territory, Occupied" objUser.put "c" , "PS"
Case "Panama" objUser.put "c" , "PA"
Case "Papua New Guinea" objUser.put "c" , "PG"
Case "Paraguay" objUser.put "c" , "PY"
Case "Peru" objUser.put "c" , "PE"
Case "Philippines" objUser.put "c" , "PH"
Case "Pitcairn" objUser.put "c" , "PN"
Case "Poland" objUser.put "c" , "PL"
Case "Portugal" objUser.put "c" , "PT"
Case "Puerto Rico" objUser.put "c" , "PR"
Case "Qatar" objUser.put "c" , "QA"
Case "Réunion" objUser.put "c" , "RE"
Case "Romania" objUser.put "c" , "RO"
Case "Russian Federation" objUser.put "c" , "RU"
Case "Russia" objUser.put "c" , "RU"
Case "Rwanda" objUser.put "c" , "RW"
Case "Saint Helena" objUser.put "c" , "SH"
Case "Saint Kitts and Nevis" objUser.put "c" , "KN"
Case "Saint Lucia" objUser.put "c" , "LC"
Case "Saint-Pierre and Miquelon" objUser.put "c" , "PM"
Case "Saint Vincent and the Grenadines" objUser.put "c" , "VC"
Case "Samoa" objUser.put "c" , "WS"
Case "San Marino" objUser.put "c" , "SM"
Case "São Tomé and Príncipe" objUser.put "c" , "ST"
Case "Saudi Arabia" objUser.put "c" , "SA"
Case "Senegal" objUser.put "c" , "SN"
Case "Serbia and Montenegro" objUser.put "c" , "CS"
Case "Seychelles" objUser.put "c" , "SC"
Case "Sierra Leone" objUser.put "c" , "SL"
Case "Singapore" objUser.put "c" , "SG"
Case "Slovakia" objUser.put "c" , "SK"
Case "Slovenia" objUser.put "c" , "SI"
Case "Solomon Islands" objUser.put "c" , "SB"
Case "Somalia" objUser.put "c" , "SO"
Case "South Africa" objUser.put "c" , "ZA"
Case "South Georgia and the South Sandwich Islands" objUser.put "c" , "GS"
Case "Spain" objUser.put "c" , "ES"
Case "Sri Lanka" objUser.put "c" , "LK"
Case "Sudan" objUser.put "c" , "SD"
Case "Suriname" objUser.put "c" , "SR"
Case "Svalbard and Jan Mayen" objUser.put "c" , "SJ"
Case "Swaziland" objUser.put "c" , "SZ"
Case "Sweden" objUser.put "c" , "SE"
Case "Switzerland" objUser.put "c" , "CH"
Case "Syrian Arab Republic" objUser.put "c" , "SY"
Case "Taiwan (Republic of China)" objUser.put "c" , "TW"
Case "Tajikistan" objUser.put "c" , "TJ"
Case "Tanzania, United Republic Of" objUser.put "c" , "TZ"
Case "Thailand" objUser.put "c" , "TH"
Case "Timor-Leste" objUser.put "c" , "TL"
Case "Togo" objUser.put "c" , "TG"
Case "Tokelau" objUser.put "c" , "TK"
Case "Tonga" objUser.put "c" , "TO"
Case "Trinidad and Tobago" objUser.put "c" , "TT"
Case "Tunisia" objUser.put "c" , "TN"
Case "Turkey" objUser.put "c" , "TR"
Case "Turkmenistan" objUser.put "c" , "TM"
Case "Turks and Caicos Islands" objUser.put "c" , "TC"
Case "Tuvalu" objUser.put "c" , "TV"
Case "Uganda" objUser.put "c" , "UG"
Case "Ukraine" objUser.put "c" , "UA"
Case "United Arab Emirates" objUser.put "c" , "AE"
Case "United Kingdom" objUser.put "c" , "GB"
Case "United States" objUser.put "c" , "US"
Case "United States Minor Outlying Islands" objUser.put "c" , "UM"
Case "Uruguay" objUser.put "c" , "UY"
Case "Uzbekistan" objUser.put "c" , "UZ"
Case "Vanuatu" objUser.put "c" , "VU"
Case "Vatican City State" objUser.put "c" , "VA"
Case "Venezuela" objUser.put "c" , "VE"
Case "Viet Nam" objUser.put "c" , "VN"
Case "Virgin Islands, British" objUser.put "c" , "VG"
Case "Virgin Islands, U.S." objUser.put "c" , "VI"
Case "Wallis and Futuna" objUser.put "c" , "WF"
Case "Western Sahara" objUser.put "c" , "EH"
Case "Yemen" objUser.put "c" , "YE"
Case "Zambia" objUser.put "c" , "ZM"
Case "Zimbabwe" objUser.put "c" , "ZW"
End Select
objUser.setinfo
'***** END OF CODE ***************************************************************