You need to sign in to do that
Don't have an account?
sajitha 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()];
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()];
Can you share the error which you are getting ?
Thanks,
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,
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.