function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sajitha Joseph 11sajitha Joseph 11 

State country picklist Enabling :Apex class still showing up in scan after code fix

HI,

I have enabled State and Country picklist in my Org and the scan identidied a number of Apex classes that needs code fixes.

I have an apex classs that was querying user object and it was querying state and country fields. As a result of the scan this class was picked up in the result and as a fix I changed ths state and country to say stateCode and countryCode hoping that this would take this class out of the scan results list.

But even after this change this class is still showing up in the scan results. 

Is it ok to ignore this?. Please comment or let me know if you need further information

Original code
user = [SELECT id, email, username, usertype, communitynickname, timezonesidkey, languagelocalekey, firstname, lastname, phone, title, street, city, PostalCode, state, country, localesidkey, mobilephone, extension, fax, contact.email FROM User WHERE id = :UserInfo.getUserId()];

Changed Code
user = [SELECT id, email, username, usertype, communitynickname, timezonesidkey, languagelocalekey, firstname, lastname, phone, title, street, city, PostalCode, stateCode, countryCode, localesidkey, mobilephone, extension, fax, contact.email FROM User WHERE id = :UserInfo.getUserId()];
 
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Sajitha,

Can you share the error which you are getting ?

Thanks,
 
sajitha Joseph 11sajitha Joseph 11
I am not getting any errors. Its just that even after changing the filed to Country code and stateCode the apex class is still showing up in the scan results
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Sajitha,

I hope you have replaced all the occurances of those fields in the apex classes. If so you can ignore those errors.

Let me know if you face any issues.

If this solution helps, Please mark it as best answer.

Thanks,
Shri RajShri Raj

It's possible that the scan results are not updating properly or that the class is still being referenced in another part of the code that hasn't been updated yet. It's best to double-check the entire class and any classes that reference it to ensure that all references to the "state" and "country" fields have been updated to "stateCode" and "countryCode" respectively. If the issue persists after this, you may want to reach out to Salesforce support for further assistance.