[SalesForce] SFDX Country/State picklist on scratch org

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

Following command:

force:source:push

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?

Best Answer

[ 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.

Related Topic