見出し画像

Property 'enableSetPasswordInApi' not valid in version 51.0 でスクラッチ組織が作成できなくなったら

大急ぎでお客様の対応をしないと!と、VisualStudio Codeを立ち上げ、スクラッチ組織を作成!!

エラー?つい先日までできてたよね?

えー!!この忙しいときに!(こういうことは忙しいときに限って起きる笑)

現象

コマンドパレットから「デフォルトのスクラッチ組織を作成」と実行すると以下のログが出力されます。

Starting SFDX: デフォルトのスクラッチ組織を作成...

06:03:49.49 sfdx force:org:create -f config/project-scratch-def.json --setalias xxx --durationdays 7 --setdefaultusername --json --loglevel fatal
06:04:45.127 sfdx force:org:create -f config/project-scratch-def.json --setalias xxx --durationdays 7 --setdefaultusername --json --loglevel fatal
ended with exit code 1

Failed to deploy settings to scratch org.

正直、これでは何も分かりません。

直接コマンドを叩いてみます。

sfdx force:org:create -f config/project-scratch-def.json --setalias xxx --durationdays 7 --setdefaultusername

エラーが表示されました。

=== Component Failures [1]
TYPE   FILE                              NAME      PROBLEM
─────  ────────────────────────────────  ────────  ───────────────────────────────────────────────────────────
Error  shape/settings/Security.settings  Security  Property 'enableSetPasswordInApi' not valid in version 51.0


=== Component Failures [1]
TYPE   FILE                              NAME      PROBLEM
─────  ────────────────────────────────  ────────  ───────────────────────────────────────────────────────────
Error  shape/settings/Security.settings  Security  Property 'enableSetPasswordInApi' not valid in version 51.0

ERROR running force:org:create:  Failed to deploy settings to scratch org.

Sprint'21の影響です

Sprint'21で「enableSetPasswordInApi」が削除されたことが原因です。

対応方法

configフォルダの「project-scratch-def.json」をのぞいてみます。

{
 "orgName": "kmatae company",
 "edition": "Developer",
 "features": [
   "PersonAccounts"
 ],
 "settings": {
   "lightningExperienceSettings": {
     "enableS1DesktopEnabled": true
   },
   "securitySettings": {
     "passwordPolicies": {
       "enableSetPasswordInApi": true
     }
   },
   "mobileSettings": {
     "enableS1EncryptedStoragePref2": false
   }
 }
}

ありました!

enableSetPasswordInApiの行を削除します。

{
 "orgName": "kmatae company",
 "edition": "Developer",
 "features": [
   "PersonAccounts"
 ],
 "settings": {
   "lightningExperienceSettings": {
     "enableS1DesktopEnabled": true
   },
   "securitySettings": {
     "passwordPolicies": {
     }
   },
   "mobileSettings": {
     "enableS1EncryptedStoragePref2": false
   }
 }
}

スクラッチ組織を作成してみます。

sfdx force:org:create -f config/project-scratch-def.json --setalias xxx --durationdays 7 --setdefaultusername

無事作成できました。

Successfully created scratch org: 00D0l00000021ocEAA, username: test-kzic4xddfddm@example.com


さて、大急ぎの仕事を片付けるか。


この記事が気に入ったらサポートをしてみませんか?