When I create new scratch org I'm not able push code which uses country/state picklist.

Following command:


give error for class:

Variable does not exist: Account.BillingStateCode

It works when I activate it manually but as I want to run unit test on CI there is not option to do it manually.

Is there any other way to activate State and Country picklist via API?

Is it sfdx bug?

  • from error it looks like the org doesn't has State and Country picklist enabled
    – Raul
    Sep 28, 2017 at 10:47
  • Yes, I know, but how can I enable it on scratch org? Manual action is not an option.
    – Mystery
    Sep 28, 2017 at 11:06
  • I do not have enough experience with SFDX, will wait for other community members to assist you.
    – Raul
    Sep 28, 2017 at 12:30
  • Did you manage to solve this issue? I came across it too. Nov 24, 2017 at 15:58
  • @JavierGarcíaManzano No. I've isolated class which use those field and added it to forceignore. When I want to deploy it I have to manually turn on Country/State picklist.
    – Mystery
    Nov 24, 2017 at 16:02

2 Answers 2


[ UPDATE! ] They have supposedly enabled this with a org definition file feature: https://releasenotes.docs.salesforce.com/en-us/summer18/release-notes/rn_sfdx_scratch_orgs.htm

Disclaimer: I have not been able to use this feature when I try to turn this on I get the error: ERROR: StateAndCountryPicklist is not a valid Features value.

[ Original Post ] I've ran into this issue as well.

I was able to configure which Countries and State to show under Step 1: Configure state and country/territory picklists.

Converted and Enabled the picklist and then... When I did a sfdx force:source:pull it pulled the configured Active/Visible country options under Address.settings-meta.xml

I tried spinning up a new scratchOrg and it pushed those configuration but I still have to manually re-convert and enable picklists again.

I know it's not the answer you're looking for but just wanted to share my progress.

  • Hopefully they'll address this issue in future releases... Dec 15, 2017 at 13:50
  • @g1ddy is it not possible to enable this via a SOAP call and then pass in the metadata to setup your lists?
    – trebleCode
    Aug 9, 2019 at 19:49

I Know this is old post

Answering just to help any other user who comes to this post

For creating scratch org with State and Country picklist add





"features": [""StateAndCountryPicklist"]

You must log in to answer this question.

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