1

I'm retrieving the metadata from my Dev Hub org in the manifest to push it to a scratch org, but I'm getting the following error in some apex classes when pushing to default scratch org:

No such column 'OtherStateCode' on entity 'Contact'. If you are attempting to use a custom field, be sure to append the '__c'

When I check in prod org (Dev Hub org) with a simple SOQL I'm able to see the field data, but if I do the same in my scratch org it throws the not such column error.

What I tried:

  1. I added the field metadata specification in my manifest (package.xml):
<types>
    <members>Contact.OtherAddress</members>
    <members>Contact.OtherStateCode</members>      
    <name>CustomField</name>
</types>

Note: OtherStateCode it's a compound field of OtherAddress

  1. I retrieve the source in manifest from Org
  2. Switch to my scratch org
  3. Push to default scratch org (and got the errors)

I also tried to search for some special setting to activate the OtherStateCode field but there's no information about it, seems to be a simple field in Salesforce.

Any help would be appreciated, thanks!

1 Answer 1

2

You can't retrieve and push this metadata; these are standard fields. You must turn on the StateAndCountryPicklist feature in your scratch org definition file:

  "features": [
    "StateAndCountryPicklist"
  ],
1
  • Thank you! , that was the solution
    – PeterPa1va
    Commented Aug 31, 2020 at 20:02

You must log in to answer this question.

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