I added a new State for the Country 'Canada' in Setup -> State and Country/Territory Picklists. The State is 'BC' and StateCode is 'BC2'. See the image below for how it looks:

enter image description here

Now that 'BC' is a valid State, I should be able to update an address field with the State = 'BC' but I am getting the following error:

First exception on row 0 with id 00Q1b000004oxi1EAA; first error: FIELD_INTEGRITY_EXCEPTION, There's a problem with this state, even though it may appear correct. Please select a state from the list of valid states.: State/Province: [State]

  • 1
    Did you set the appropriate country as well? If you fail to do so, you'd get this error.
    – sfdcfox
    Commented Jan 25, 2019 at 4:26
  • @sfdcfox I added the State by clicking 'Edit' beside Canada, then Add State. How do I set the appropriate country? Unless you mean that before setting the Lead's State to 'BC', I set the Country to 'Canada', which I did
    – tom_12321
    Commented Jan 25, 2019 at 4:29
  • @sfdcfox I did get it so that 'BC' is available under the 'State' picklist when I go to a Lead record which I didn't have working before. But i am still getting that error when updating the State through Apex. Any idea what might cause that? Thanks for your help!
    – tom_12321
    Commented Jan 25, 2019 at 4:41

1 Answer 1

  1. State integration values must match with State code. enter image description here

  2. You need to set country as well while creating record as shown below

    Account objAccount = new Account(Name='Sample',

    INSERT objAccount;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .