var selectedCountryValue = Xrm.Page.getAttribute(/cra1c_countriespcf/).getValue();
' is returning FRA instead of France. FRA does not exist as a label in my option-set. This is the case with any other selected choice: instead of getting New Zealand, I get NZL, AUS instead of Australia, etc...// JavaScript function to find and set the corresponding value in the new_ti_countries fieldfunction setNewTiCountriesValue() { // Get the selected country value from cra1c_countriespcf field var selectedCountryValue = Xrm.Page.getAttribute(/cra1c_countriespcf/).getValue(); // Check if the selected country value is not null if (selectedCountryValue !== null) { // Log the selected country value for debugging console.log(/Selected Country Value:/, selectedCountryValue); // Fetch the global choice option-set new_ti_countries var globalOptionSet = Xrm.Page.getAttribute(/new_ti_countries/).getOptions(); // Log all available values in new_ti_countries for debugging console.log(/Available Values in new_ti_countries:/); for (var i = 0; i < globalOptionSet.length; i++) { console.log(globalOptionSet[i].value, globalOptionSet[i].text); if (globalOptionSet[i].value === selectedCountryValue) { // Set the corresponding value to the new_ti_countries field Xrm.Page.getAttribute(/new_ti_countries/).setValue(selectedCountryValue); return; } } console.error(/Corresponding value not found for the selected country./); }}