Custom Metadata Types Basics >  Use Custom Metadata Types in Formulas, Default Values, and Validation Rules


https://trailhead.salesforce.com/ja/content/learn/modules/custom_metadata_types_dec/cmt_formulas

最近よくこの質問を見かけます

こうやってエラーを集めてみると過去の設定が影響している感じですね。

:::note
I think the settings for the previous challenge remain. 


For example, if the field's required option was enabled, disable it.
Setup-->Object Manager --> Choose (Opportunity)-->Fields-->Edit(Discount_Percent__c) and uncheck required

If you don't know the old settings, I recommend using the new playground.
:::

# We can't check your work because something in your org prevents creating and updating account and opportunity records. Chec


+ [Hi Community, I'm getting the below error while submitting the challenge "Challenge not yet complete in Curious Raccoon Playground We can't check your work because something in your org prevents creating and updating account and opportunity records. Chec"](https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000PkpZ0SAJ)

:::note
I can see that the challenge "Create and Manage Custom Metadata Types" already passed successfully and the error you are seeing is in the next unit "Use Custom Metadata Types in Formulas, Default Values, and Validation Rules" and it's due to the incorrect validation formula.


I have replaced the "Revenue_Validation" validation rule formula as below and it worked successfully.

課題「カスタム メタデータ タイプの作成と管理」はすでに成功しており、表示されているエラーは次の単元「式、デフォルト値、および検証ルールでのカスタム メタデータ タイプの使用」にあり、検証が正しくないことが原因であることがわかります。方式。


以下のように「Revenue_Validation」検証ルール式を置き換えたところ、正常に機能しました
 
```
IF(

  (ISPICKVAL( Support_Tier__c , "Gold")

    &&

  ( AnnualRevenue <

  20*$CustomMetadata.Support_Tier__mdt.Gold.Minimum_Spending__c

  )

 ), TRUE, FALSE

)
```

:::

+ [The error message on Custom Metadata Types Basic/Use Custom Metadata Types in Formulas, Default Values, and Validation Rules](https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000R993P)

:::note
I had to deactivate a validation rule that required the account number to be 8 characters, which I must have set up in a previous tutorial.
:::


# 同じ質問

+ [Hi Community, I'm getting the below error while submitting the challenge "Challenge not yet complete in Curious Raccoon Playground We can't check your work because something in your org prevents creating and updating account and opportunity records. Chec"](https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000PliLRSAZ)

# We can't check your work because something in your org prevents creating and updating account and opportunity records. Check the settings and configuration of your org. Make sure you can create and update account and opportunity records. Then click Check Challenge again.

+ [I got error "We can't check your work because something in your org prevents creating and.."
](https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000PjtHt)

https://trailhead.salesforce.com/content/learn/modules/custom_metadata_types_dec/cmt_formulas

:::note
Please check if there is any validation rule or may be trigger are prevent you from create and update account and opportunity records.

Check the permission set also.
:::

+ [Cant complete Use Custom Metadata Types in Formulas, Default Values, and Validation Rules Challenge](https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000Pf4CT)

:::note
I found out there is an required field (Discount_Percent__c) I created in Opportunity object (for another Trailhead module) so I must fill in this field whenever I create an oppt record (for any exercise or challenge). So I modified the setting of this field to make it NOT required. Then I verified the hands-on challenge and it passed. 

Opportunity オブジェクト (別の Trailhead モジュール用) に作成した必須フィールド (Discount_Percent__c) があることがわかりました。そのため、(演習またはチャレンジ用に) oppt レコードを作成するたびに、このフィールドに入力する必要があります。そこで、このフィールドの設定を変更して必須ではないようにしました。次に、ハンズオン チャレンジを検証したところ、成功しました。
:::


+ [Use Custom Metadata Types in Formulas, Default Values, and Validation Rules](https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007NCk4z)

:::note
Please try to deactivate trigger, validation rule on object if any
:::

+ [I got error message on Custom Metadata Types Basic/Use Custom Metadata Types in Formulas, Default Values, and Validation Rules](https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000Pf5cN)

:::note
I can see that the challenge "Create and Manage Custom Metadata Types" already passed successfully and the error you are seeing is in the next unit "Use Custom Metadata Types in Formulas, Default Values, and Validation Rules" and it's due to the incorrect validation formula.

I have replaced the "Revenue_Validation" validation rule formula as below and it worked successfully. 

```
IF(
  (ISPICKVAL( Support_Tier__c , "Gold")
    &&
  ( AnnualRevenue <
  20*$CustomMetadata.Support_Tier__mdt.Gold.Minimum_Spending__c
  )
 ), TRUE, FALSE
 )
```

https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000PkpZ0SAJ


「カスタム メタデータ タイプの作成と管理」という課題はすでに成功していることがわかります。表示されているエラーは次の単元「数式、デフォルト値、および検証ルールでカスタム メタデータ タイプを使用する」にあり、誤った検証が原因です。式。

「Revenue_Validation」検証ルール式を以下のように置き換えたところ、正常に機能しました。
:::